How to use the fibonacci calculator
- Choose what to find: the Nth Fibonacci number, a list of the first terms, or whether a number is a Fibonacci number.
- For the Nth number, type the position N from 0 to 3,000. For a list, type how many terms you want, up to 200. To test a number, type any whole number of up to 60 digits.
- Read the answer, shown with commas. Large terms keep every digit because the arithmetic is exact.
- In list mode, use the CSV button to export the terms with their running sums.
Formula
F(0) = 0, F(1) = 1
F(N) = F(N-1) + F(N-2)
F(0) + F(1) + ... + F(N) = F(N+2) - 1
n is Fibonacci when 5n^2 + 4 or 5n^2 - 4 is a perfect square
The ratio of one term to the one before it approaches the golden ratio, about 1.6180339887. The list starts at F(0) = 0, so the first ten terms are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.
F(30) and the number 144
F(30) = 832,040, a six digit number. The terms from F(0) to F(30) add up to 2,178,308, which equals F(32) - 1, and F(30) divided by F(29) = 832,040 / 514,229 = 1.6180339887, the golden ratio to ten places.
Is 144 a Fibonacci number? Yes: 5 x 144^2 + 4 = 103,684 = 322^2, so it is F(12), preceded by 89 and followed by 233. For 1,000 the answer is no, and it falls between 987 and 1,597. F(100) = 354,224,848,179,261,915,075, and F(3000) has 627 digits.
Where the sequence shows up
Fibonacci numbers appear in counting problems such as the number of ways to climb stairs taking one or two steps at a time, in the analysis of algorithms, and in the spacing of leaves and seeds in some plants. Neighboring terms get closer and closer to the golden ratio, which you can explore with the golden ratio calculator.
The same numbers sit on the diagonals of Pascal's triangle, where sums along shallow diagonals give Fibonacci numbers.
Exact numbers for large positions
Ordinary computer numbers lose exactness above about 9 quadrillion, which is reached at F(79). This page uses whole-number arithmetic with no size limit, so even F(3000), with 627 digits, is exact. The limits of 3,000 positions and 60 digits are only there to keep the page quick.
Looking for factors? The prime number calculator tests and factors whole numbers, and the number base converter writes them in other bases.
Assumptions and limits
- The sequence starts with F(0) = 0 and F(1) = 1. Some books start the list at 1, 1 and number the terms from 1, which shifts every position by one.
- Only non-negative positions are supported. Negative positions extend the sequence with alternating signs and are not modeled.
- The number test accepts whole numbers only, up to 60 digits.
- The golden ratio line is a reference value shown to ten decimal places.
Frequently asked questions
What are the first Fibonacci numbers?
Starting from position 0 they are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144. Each one is the sum of the two before it. The list mode shows as many as you ask for, with running sums.
How do I find the Nth Fibonacci number?
Choose the Nth Fibonacci number, type N, and read F(N). For example, F(10) is 55 and F(50) is 12,586,269,025. The page adds the previous two terms repeatedly using exact whole numbers.
How can a number be tested without listing the sequence?
A whole number n is a Fibonacci number exactly when 5n squared plus 4 or 5n squared minus 4 is a perfect square. The page uses that test and then finds the position by counting up.
Why does the ratio of neighbors approach 1.618?
Each term is the sum of the two before it, so the ratio of neighbors settles toward the positive solution of x squared = x + 1, which is (1 + square root of 5) / 2, the golden ratio.