HomeMath › Fibonacci Number Calculator

Fibonacci Number Calculator

Computes the n-th Fibonacci number exactly with arbitrary-precision integers, together with F(n−1), F(n+1), the ratio F(n)/F(n−1) compared with the golden ratio, and optionally tests whether a given integer is a Fibonacci number.

When to use

You need a specific Fibonacci number (exact, even with hundreds of digits), the terms around it, or want to check whether a number belongs to the sequence.

Do not use when: You need a general geometric or arithmetic progression (use geometric-sequence / arithmetic-sequence) or factorials and binomial coefficients (use factorial, combinations-permutations).

Formula

F(0) = 0, F(1) = 1, F(n) = F(n − 1) + F(n − 2); φ = (1 + √5)/2; N is a Fibonacci number ⇔ 5N² + 4 or 5N² − 4 is a perfect square (Gessel's test)

Inputs

ParameterTypeUnitRequiredDescription
nintegeryesPosition in the sequence with F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2, … Range: ≥ 0, ≤ 500
check_numberstringnoOptional non-negative integer (as digits, any size) to test for membership in the Fibonacci sequence.

Outputs

OutputTypeUnitDescription
fibonaccistringThe n-th Fibonacci number as an exact decimal string.
fibonacci_numbernumberThe same value as a number; omitted from F(74) on (above 2^50), where a number would no longer carry every digit.
previousstringThe preceding Fibonacci number (omitted for n = 0).
nextstringThe following Fibonacci number.
rationumberRatio of consecutive terms, which converges to the golden ratio (omitted for n ≤ 1).
golden_rationumber(1 + √5) / 2 = 1.6180339887…, the limit of the ratio.
digitsintegerDecimal digits of F(n).
is_fibonaccibooleantrue when 5·N² + 4 or 5·N² − 4 is a perfect square (only when check_number is given).
check_indexintegerThe smallest k with F(k) = check_number (only when it is a Fibonacci number).

Example

F(50), is 144 Fibonacci?: {"n":50,"check_number":"144"}{"fibonacci":"12586269025","fibonacci_number":12586269025,"previous":"7778742049","next":"20365011074","ratio":1.6180339887,"golden_ratio":1.6180339887,"digits":11,"is_fibonacci":true,"check_index":12}

F(10): {"n":10}{"fibonacci":"55","fibonacci_number":55,"previous":"34","next":"89","ratio":1.6176470588,"digits":2}

GET https://tttkmbb.com/api/v1/calculate/fibonacci?n=50&check_number=144

Machine access

Sources

FAQ

Does the sequence start with 0 or 1?

This calculator uses the standard indexing F(0) = 0, F(1) = 1 (OEIS A000045), so F(10) = 55. Some texts start at F(1) = 1, F(2) = 1, which shifts the index by one.

How large can n be?

Up to 500: F(500) has 105 digits and is returned exactly as a string. The number output is omitted from F(74) on, because values above 2^50 cannot be returned as exact numbers.

Related calculators