Skip to content
SimpleConvertSimpleConvert

Fibonacci Sequence

Generate the Fibonacci sequence to any length with exact big-integer arithmetic, and watch the ratio of consecutive terms converge on the golden ratio.

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

How to use it

  • Choose how many terms you want, up to 500.
  • Every digit is exact — the sequence uses big integers, not floating point.
  • Watch the ratio tile approach 1.618033989 as the sequence grows.

Examples

First 10 terms0, 1, 1, 2, 3, 5, 8, 13, 21, 34
F(20)4181

The Fibonacci sequence starts at 0 and 1, and every term after that is the sum of the two before it: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55… It is named after Leonardo of Pisa, known as Fibonacci, who introduced it to Europe in 1202 in his book Liber Abaci — though the sequence had already been described centuries earlier by Indian mathematicians studying Sanskrit poetic metre.

This generator produces any number of terms using exact big-integer arithmetic rather than floating-point numbers, so every digit is correct even at the 500th term, where the value runs to over a hundred digits.

The formula

F(0) = 0, F(1) = 1, and F(n) = F(n−1) + F(n−2) for every term after that. It is one of the simplest recurrence relations in mathematics, which is part of why the sequence turns up in so many unrelated places.

Why big integers matter here

A standard JavaScript number can only represent integers exactly up to 2^53. F(79) is 14,472,334,024,676,221 — already past that point — so any calculator using ordinary floating-point arithmetic starts silently rounding terms from around there onward. This generator uses BigInt throughout, so F(500), which has 105 digits, comes out exact to the last digit.

The golden ratio connection

Divide any Fibonacci number by the one immediately before it, and the result converges on φ (phi), the golden ratio, approximately 1.6180339887. F(10) ÷ F(9) is 55 ÷ 34 ≈ 1.6176; by F(20) ÷ F(19) the ratio is already accurate to six decimal places.

The exact relationship is Binet's formula, F(n) = (φⁿ − ψⁿ) ÷ √5, where ψ = (1 − √5) ÷ 2. Because |ψ| is less than 1, the ψⁿ term shrinks toward zero as n grows, which is exactly why the ratio of consecutive terms homes in on φ.

Where the sequence turns up

  • Phyllotaxis — the spiral arrangement of seeds in a sunflower head or scales on a pinecone, which follow Fibonacci numbers to pack as efficiently as possible.
  • The Fibonacci retracement levels used in technical analysis of financial charts.
  • Algorithm analysis — the worst case for Euclid's GCD algorithm occurs on consecutive Fibonacci numbers.
  • Population growth models, since the sequence was originally devised to describe idealised rabbit breeding.

Questions people ask

What is the connection to the golden ratio?

Divide any Fibonacci number by the one before it and the answer converges on φ = (1 + √5) / 2 ≈ 1.618. The further along the sequence, the closer it gets.

Why use big integers?

F(79) already exceeds what a JavaScript number can represent exactly. Beyond that point ordinary arithmetic starts returning wrong digits, so the generator uses BigInt throughout.

Does this page need an internet connection?

Only the first time. The whole table is part of the page, and the service worker caches it, so it keeps working offline afterwards.

Runs entirely in your browser. Nothing you type is uploaded, logged or shared.

Last updated 22 August 2026