Fibonacci Numbers

Generate the Fibonacci sequence for any number of terms, with sum, golden ratio approximation, and flexible output formats.

Runs locally
Terms
—
Sum
—
Last value
—
Golden ratio
—
Sequence

What is the Fibonacci sequence?

The Fibonacci sequence is a series where each number is the sum of the two before it: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34… It was first described in India and popularized in Europe by Leonardo of Pisa (Fibonacci) in 1202. The sequence appears in nature — the spiral arrangement of sunflower seeds, pine cones, and nautilus shells — and has deep connections to the golden ratio φ ≈ 1.6180339887. The ratio of successive Fibonacci numbers converges to φ as the sequence grows.

How to use this tool

  1. 1 Set N to the number of terms you want.
  2. 2 Set "Start at index" to 0 (starting with F(0)=0) or 1 (starting with F(1)=1) depending on your convention.
  3. 3 Choose a separator — newline works well for lists, comma for arrays.
  4. 4 Toggle "Show index prefix" to display n: value on each line.

Frequently asked questions

What is the maximum N?

Up to 100 terms. JavaScript BigInt is used so there is no overflow — F(100) is a 21-digit number and is computed exactly.

Why does the golden ratio not equal exactly φ?

The tool shows F(n)/F(n-1) for the last term, which approximates φ but only converges as n approaches infinity. At n=20 you already get 9 correct decimal places.

Is there a Fibonacci formula instead of iteration?

Yes — Binet's formula φⁿ/√5 gives F(n) directly, but it requires arbitrary-precision arithmetic for large n because float64 loses precision. The iterative addition this tool uses is exact for any n when BigInt is available.

Does the sequence start at 0 or 1?

Both conventions exist. The modern mathematical convention starts at F(0)=0. The original definition starts at F(1)=1. Use the "Start at index" option to choose.

Is anything sent to a server?

No. The sequence is computed locally using BigInt arithmetic.