Skip to content

Fibonacci Calculator

Find the exact nth Fibonacci or Lucas number up to n = 10,000, list terms, sum them, and test whether a number is in the Fibonacci sequence.

Calculator Details

F(20):6,765See results ↓

The nth term, a list of terms, or whether a number is in the sequence

Fibonacci (0, 1, 1, 2…), Lucas (2, 1, 3, 4…) or your own two starting values

Counting from F(0) = 0; up to 10,000

Your Results

F(20): 6,765

F(20)

6,765

Sum F(0) + … + F(20)

17710

= F(22) − F(1)

Number of digits

4

Ratio to the term before

1.61803396317

Tends to φ = 1.6180339887…

Binet’s φⁿ ÷ √5

6,765.00002956

F(n) is the nearest whole number

F(20) = 6765, and the terms from F(0) to F(20) add up to 17710.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

F(20) and the terms before it
nF(n)Digits
156103
169873
1715974
1825844
1941814
20 (you)67654

How This Calculator Works

How It’s Calculated

F(0) = 0, F(1) = 1, F(n) = F(n − 1) + F(n − 2)

Fast doubling: F(2k) = F(k)·(2F(k+1) − F(k)), F(2k+1) = F(k)² + F(k+1)²

Sum to n = F(n + 2) − F(1) = 17710

Every value is an exact whole number, however many digits it has. Fast doubling needs only about log₂ n steps, so F(10,000) takes 14 rounds instead of 10,000 additions.

Frequently Asked Questions

What is the Fibonacci sequence?

The sequence 0, 1, 1, 2, 3, 5, 8, 13, 21… in which each term is the sum of the two before it. It is named after Leonardo of Pisa (Fibonacci), whose 1202 book Liber Abaci used it to count rabbit pairs, although Indian mathematicians described it centuries earlier.

What is the 20th Fibonacci number?

Counting from F(0) = 0, F(20) = 6,765. If your source counts from F(1) = 1, F(2) = 1, the numbering is the same (F(1) = F(2) = 1), but some books start at F(1) = 0, which shifts every index by one. The calculator follows OEIS A000045.

How big do Fibonacci numbers get?

They grow by a factor of about 1.618 each step, so the number of digits rises steadily: F(100) has 21 digits and F(1000) has 209. The calculator gives exact values up to F(10,000), which has 2,090 digits.

How is the Fibonacci sequence related to the golden ratio?

The ratio of consecutive terms approaches φ = (1 + √5)/2 ≈ 1.6180339887. F(20)/F(19) is already 1.6180339632. Binet’s formula makes the link exact: F(n) = (φⁿ − ψⁿ)/√5 with ψ = (1 − √5)/2.

What is the sum of the first n Fibonacci numbers?

F(0) + F(1) + … + F(n) = F(n + 2) − 1. For n = 20 that is F(22) − 1 = 17,710. The same trick works for any sequence with the Fibonacci rule: the sum is the term two places on, minus term 1.

How can I tell if a number is a Fibonacci number?

A whole number x is a Fibonacci number exactly when 5x² + 4 or 5x² − 4 is a perfect square. 144 passes (5 × 144² + 4 = 322²); 150 does not, and lies between 144 and 233.

What are Lucas numbers?

The sequence with the same rule but starting 2, 1: 2, 1, 3, 4, 7, 11, 18… L(10) = 123. Lucas numbers are closely tied to Fibonacci numbers, for example F(2n) = F(n) × L(n). Choose “Custom starting values” for any other pair.

Included: exact Fibonacci, Lucas and custom-start terms up to n = 10,000 (OEIS A000045 numbering, F(0) = 0), lists of up to 100 terms, sums, the ratio to the previous term, Binet’s approximation and the 5x² ± 4 membership test. Left out: negative indices (F(−n) = (−1)ⁿ⁺¹F(n)), Fibonacci numbers modulo m (Pisano periods), Zeckendorf representations and other generalisations such as tribonacci. The golden ratio page has the ratio table.

Fibonacci Calculator: nth Term, Sums, Lucas Numbers and Tests

By FindMySum · Last reviewed

The Fibonacci sequence starts 0, 1, and every later term is the sum of the two before it: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144… This calculator finds any term exactly, up to F(10,000), a number with 2,090 digits. It also lists a run of terms and their sum, tells you whether a number belongs to the sequence, and handles the Lucas numbers and any sequence with your own two starting values.

The rule and the numbering

F(0) = 0, F(1) = 1, F(n) = F(n − 1) + F(n − 2)

The calculator follows the numbering of OEIS A000045, the standard reference, so F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2. If your textbook starts with F(1) = 1, F(2) = 1, its numbers match these. If it starts with F(1) = 0, subtract one from its index.

Worked example: the default

The calculator opens with n = 20:

n151617181920
F(n)6109871,5972,5844,1816,765

So F(20) = 6,765. The sum of all the terms from F(0) to F(20) is F(22) − 1 = 17,711 − 1 = 17,710, and the ratio 6,765 ÷ 4,181 = 1.6180339632, already within 0.00000003 of the golden ratio.

How large terms are computed exactly

Adding terms one at a time works, but the calculator uses the fast doubling identities:

F(2k) = F(k) × (2F(k + 1) − F(k)) F(2k + 1) = F(k)² + F(k + 1)²

Each step doubles the index, so F(10,000) needs about 14 steps instead of 10,000 additions. All arithmetic uses whole numbers of unlimited length, so every digit is exact. A spreadsheet or a calculator using ordinary floating point loses exactness at F(79), the first term above 2⁵³.

The sum of the terms

There is a neat shortcut for the running total:

F(0) + F(1) + … + F(n) = F(n + 2) − 1

You can see why by adding 1 = F(1) to the sum: F(1) + F(0) + F(1) = F(2) + F(1) = F(3), then + F(2) gives F(4), and so on until the whole sum collapses to F(n + 2). The same argument shows that for any sequence with the Fibonacci rule, the sum from term 0 to term n is term n + 2 minus term 1. In list mode, the calculator sums exactly the terms shown.

Binet's formula and the golden ratio

The Fibonacci numbers have a closed form, named after Jacques Binet:

F(n) = (φⁿ − ψⁿ) ÷ √5, with φ = (1 + √5) ÷ 2 ≈ 1.618034 and ψ = (1 − √5) ÷ 2 ≈ −0.618034

Because |ψ| is less than 1, ψⁿ shrinks to nothing, and F(n) is simply φⁿ ÷ √5 rounded to the nearest whole number. That is why the ratio of consecutive terms approaches φ, and why each term has, on average, about 0.209 more digits than the one before (log₁₀ φ ≈ 0.20899). The calculator shows Binet's value next to the exact one for terms small enough to fit in ordinary decimal arithmetic.

Is a number in the sequence?

A whole number x is a Fibonacci number exactly when at least one of 5x² + 4 and 5x² − 4 is a perfect square. For x = 144, 5 × 144² + 4 = 103,684 = 322², so 144 is a Fibonacci number, F(12). For x = 150, neither 112,504 nor 112,496 is a square, so 150 is not; the calculator also finds its neighbours, F(12) = 144 and F(13) = 233. For Lucas and custom sequences, which the square test does not cover, it searches the sequence directly.

Lucas numbers and custom starts

Keep the rule, change the starting values, and you get a different sequence. Starting with 2 and 1 gives the Lucas numbers, 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123…, which share most of the Fibonacci numbers' properties, for example L(n) = F(n − 1) + F(n + 1) and F(2n) = F(n) × L(n). Any other start a, b gives the sequence a·F(n − 1) + b·F(n), and its consecutive ratios also approach φ.

Fibonacci numbers in the world

  • Plants: the number of spirals in sunflower heads, pine cones and pineapples is usually a Fibonacci number, because each new seed grows at about 137.5° (the golden angle) from the last.
  • Computer science: Fibonacci heaps, Fibonacci search and the worst case of Euclid's algorithm (consecutive Fibonacci numbers take the most steps) all come from the sequence.
  • Agile planning: story points of 1, 2, 3, 5, 8, 13 use the growing gaps to signal that bigger estimates are less precise.
  • Unit conversion: consecutive Fibonacci numbers give a quick miles-to-kilometres rule (5 mi ≈ 8 km, 8 mi ≈ 13 km), because φ is close to 1.609.

More questions

Is 0 a Fibonacci number?

In the modern convention used by OEIS and most mathematics texts, yes: F(0) = 0. Some older books and puzzles start the sequence at 1, 1. The values are the same either way; only the numbering of the terms changes.

Are there infinitely many Fibonacci primes?

Nobody knows. Fibonacci primes such as 2, 3, 5, 13, 89, 233 and 1597 keep appearing, but whether there are infinitely many is an open problem. A useful fact: F(n) can only be prime when n is prime (or n = 4), though most prime n do not give a prime.

Do Fibonacci numbers really appear in nature?

Some do, convincingly: the spiral counts in sunflower heads and pine cones are usually consecutive Fibonacci numbers such as 34 and 55, a result of how new seeds are packed at a constant angle. Many popular claims, about the human body, the Parthenon or nautilus shells, do not hold up when measured.

What is the Fibonacci retracement used in trading?

Chart analysts draw horizontal lines at 23.6%, 38.2%, 61.8% and similar fractions of a price move, taken from ratios of Fibonacci numbers. These are conventions of technical analysis, not consequences of the mathematics, and there is little evidence that prices respect them.

Why do programmers compute Fibonacci numbers?

It is the standard first example of recursion and of why naive recursion is slow: computing F(n) by calling F(n − 1) and F(n − 2) repeats work exponentially. Memoisation, iteration and fast doubling show how a better algorithm turns an impossible computation into an instant one.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy