factordbrpc · fdb
Sign in

Expression syntax

The search box takes far more than a plain number. You can type an arithmetic expression and the server evaluates it to a single integer, then looks that number up (or, with Create, adds it). Whitespace is ignored, and multiplication may be left implicit: 2(3+4) means 2*(3+4). Reading never stores anything.

Every result is capped at about 10 000 000 digits, and each function below has a fixed input ceiling chosen so a single evaluation stays near 3 seconds. Over the ceiling the request is declined rather than run.

Operators

OperatorMeaningExample
+   -Addition, subtraction2^100-2^50+1
*   /Multiplication, exact division (the result must be a whole number)(2^100+1)/3
^Power (right-associative: 2^3^2 = 2^(3^2))2^127-1
%Modulo (remainder)2^100%1000000007
\Integer division: a\b = ⌊a/b⌋, the quotient rounded down (same precedence as * / %)2^100\7+1
( )Grouping(10^500-1)/9

Intermediate values may be negative, but the final result may not - 3-5 is rejected. There is no unary minus; write a negative argument as 0-1 where one is needed (see the functions below).

Shortcuts

FormMeaningExample
MnMersenne number, 2n-1M127
FnFermat number, 22n+1F5
n!Factorial1000!
n#Primorial - product of all primes ≤ n100#
n##   n~Product of the first n primes10##
I(n)   fib(n)Fibonacci numberI(5000)
Ln   lucas(n)Lucas numberlucas(5000)
b,n+   b,n-Shorthand for bn±12,127-
#idThe stored number with that database id (used inside a larger expression)#1100000000000000001/17

Named functions

Each is written NAME(argument, …). Every argument may itself be an expression, so Q(5+5) and 2^Q(50)-1 are fine, and functions nest: Q(Z(10)). The right-hand column is the largest input accepted (matched to the ~3 second budget); for the families marked † a very large parameter is also declined early when the result would exceed the digit limit.

FunctionMeaningOEISExampleMax input
Q(n)Perrin numberA001608Q(1000)n ≤ 30 M
Z(n)Motzkin numberA001006Z(500)n ≤ 700 k
&(n)Narayana's cowsA000930&(1000)n ≤ 30 M
$(n)Padovan numberA000931$(1000)n ≤ 40 M
K(n)Sum of factorials, 1!+2!+…+n!A007489K(100)n ≤ 2 M
A(n)Alternating factorial, n!-(n-1)!+…A005165A(100)n ≤ 2 M
N(m,n)Multifactorial n·(n-m)·(n-2m)·…  (m=1 is the factorial, m=2 the double factorial)-N(2,7)n ≤ 4 M
H(m,n)Metallic m-Fibonacci: F=m·F-1+F-2  (m=1 Fibonacci, m=2 Pell)A000045/A000129H(2,100)† n ≤ 50 M
Y(m,n)m-step Lucas (sum of the previous m terms)A001644…Y(3,100)m3·n ≤ 5.4·108
U(n,p,q)Lucas sequence Un(p,q): U=p·U-1-q·U-2, U0=0, U1=1-U(20,1,0-1)† n ≤ 50 M
V(n,p,q)Lucas sequence Vn(p,q): V=p·V-1-q·V-2, V0=2, V1=p-V(20,1,0-1)† n ≤ 50 M
R(m,n)Repunit - n ones in base m, i.e. (mn-1)/(m-1)A002275R(10,5)† n ≤ 20 M
S(m,n)Smarandache - concatenate 1,2,…,n written in base mA007908S(10,6)n ≤ 2.5 M
@(n)The n-th prime (1-based: @(1) is 2)A000040@(1000000)n ≤ 6.5·1012

The Lucas U/V parameters p and q may be negative; since there is no unary minus, write them as a subtraction - U(20,1,0-1) is the Fibonacci numbers (p=1, q=-1) and V(20,1,0-1) the Lucas numbers. Repunit and Smarandache bases must be at least 2, and the multifactorial step at least 1.