# Fibonacci Calculator

## Calculator Use

With the Fibonacci calculator you can generate a list of Fibonacci numbers from start and end values of n. You can also calculate a single number in the Fibonacci Sequence,
*F _{n}*, for any value of n up to n = ±500.

## Fibonacci Sequence

The Fibonacci Sequence is a set of numbers such that each number in the sequence is the sum of the two numbers that immediatly preceed it.

\[ F_{0} = 0,\quad F_{1} = F_{2} = 1, \]and

\[ F_{n}=F_{n-1}+F_{n-2} \]For example, calculating *F _{4}*

The first 15 numbers in the sequence, from *F _{0}* to

*F*, are

_{14}0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377

## Fibonacci Sequence Formula

The formula for the Fibonacci Sequence to calculate a single Fibonacci Number is:

\[ F_{n}={\dfrac{(1+\sqrt{5})^{n}-(1-\sqrt{5})^{n}}{2^{n}\sqrt{5}}} \]or

*F _{n}* = ( (1 + √5)^n - (1 - √5)^n ) / (2^n × √5)

for positive and negative integers n.

A simplified equation to calculate a Fibonacci Number for only positive integers of n is:

\[ F_{n}=\left[{\dfrac{(1+\sqrt{5})^{n}}{2^{n}\sqrt{5}}}\right] \]or

*F _{n}* = [( (1 + √5)^n ) / (2^n × √5)]

where the brackets in [x] represent the nearest integer function. Simply put, this means to round up or down to the closest integer.

A more compact version of the formula used is:

\[ F_{n} = \dfrac{ \phi^{n} - \psi^{n} }{ \sqrt{5}} \]or

*F _{n}* = ( φ^n - ψ^n ) / √5

where φ, the Greek letter phi, is the Golden Ratio φ = (1 + √5) / 2 ≈ 1.618034... and ψ, the Greek letter psi, is ψ = (1 - √5) / 2 ≈ -0.618034...

Since it can be shown that ψ^n is small and gets even smaller as n gets larger, when only working with positive integers of n, the compact Fibonacci Number formula is true:

\[ F_{n} = \left[ \dfrac{\phi^n}{\sqrt{5}} \right] = \left[ {\dfrac{(1+\sqrt{5})^{n}}{2^{n}\sqrt{5}}}\right]\]where the brackets in [x] represent the nearest integer function as defined above.

### Negative Fibonacci Numbers

Unless stated otherwise, formulas above will hold for negative values of
*n* however, it could be easier to find *F _{n}* and solve for

*F*using the following equation.

_{-n}Putting it another way, when *-n* is odd, *F _{-n}* =

*F*and when

_{n}*-n*is even,

*F*=

_{-n}*-F*.

_{n}If you are generating a sequence of
*-n* by hand and working toward negative infinity, you can restate the sequence equation above and use this as a starting point:

and

\[ F_{n}=F_{n+2}-F_{n+1} \]For example with *n = -4* and referencing the table below

*F*_{-9} to *F*_{9}

_{-9}

_{9}

*F*

_{n}## References

Knuth, D. E., The Art of Computer Programming. Volume I. Fundamental Algorithms, Addison-Wesley, 1997, Boston, Massachusetts. pages 79-86

Chandra, Pravin and
Weisstein, Eric W. "Fibonacci Number." From
*MathWorld*--A Wolfram Web Resource.
https://mathworld.wolfram.com/FibonacciNumber.html

**Cite this content, page or calculator as:**

Furey, Edward "Fibonacci Calculator" at https://www.calculatorsoup.com/calculators/discretemathematics/fibonacci-calculator.php from CalculatorSoup,
*https://www.calculatorsoup.com* - Online Calculators