Fibonacci Number Calculator

Instructions

Enter an integer n between 0 and 10000 inclusive to calculate the nth fibonacci number.

What is a Fibonacci Number?

Fibonacci numbers are a sequence Fn of non-negative integer numbers where each consecutive number is the sum of the two prior numbers in the sequence, except for zero and one, which equal themselves.

The golden ratio (1.618033988749894...) can be closely approximated by the ratio of two consecutive fibonacci numbers. For example: F20 / F19 = 6765 / 4181 = 1.618034...

Fibonacci numbers often occur in nature. Some examples include the branching of a tree, the arrangements of leaves on a stem, or the number of petals on a flower.

How do you calculate a Fibonacci number?

The nth fibonacci number can be calculated either recursively or explicitly.

To calculate a fibonacci number recursively, start with F0 = 0, F1 = 1, and continue adding the previous two numbers until you get the nth number.

$$( F(n) = \begin{cases} 0 & \text{if $n=0$} \\ 1 & \text{if $n=1$} \\ F(n-1) + F(n-2) & \text{if $n>1$} \end{cases})$$

To calculate a fibonacci number explicitly, use Binet's formula: ((1 + √5)n − (1 − √5)n) / (2n√5).

$$(F_n=\frac{(1+\sqrt{5})^n-(1-\sqrt{5})^n}{2^n\sqrt{5}})$$