Math

Fibonacci Sequence Calculator (F(n) = F(n-1) + F(n-2))

Compute Fibonacci numbers up to F(100) exactly using BigInt. Visualise convergence to the golden ratio φ, Lucas numbers, and a bar chart of the first N terms.

Tips

  • The Fibonacci sequence is defined by F(n) = F(n−1) + F(n−2) with F(1) = F(2) = 1 as starting values.
  • The ratio of consecutive terms F(n+1)/F(n) converges to the golden ratio φ ≈ 1.618 as n increases. Watch it happen in the convergence table.
  • For n > 78, JavaScript 64-bit floats can no longer represent Fibonacci numbers exactly. The "Find nth term" field uses BigInt to compute F(n) accurately up to n = 100.
  • Fibonacci numbers appear throughout nature: the spiral arrangement of sunflower seeds, pinecone scales, and nautilus shells all follow Fibonacci patterns (phyllotaxis).

FAQ

Both conventions exist. This tool uses the 1-indexed convention F(1) = 1, F(2) = 1, which is common in Japanese high-school mathematics. The 0-indexed convention F(0) = 0, F(1) = 1 is equally valid and more common in computer science.

Lucas numbers share the same recurrence L(n) = L(n−1) + L(n−2) as Fibonacci, but with different starting values: L(1) = 1, L(2) = 3, giving 1, 3, 4, 7, 11, 18, 29, … They converge to the golden ratio at the same rate as Fibonacci numbers.

Binet's formula is the closed-form expression F(n) = (φⁿ − ψⁿ) / √5, where φ = (1+√5)/2 and ψ = (1−√5)/2. It gives any Fibonacci number directly from n, without computing previous terms. In practice, floating-point errors make it unreliable for large n, which is why this tool uses integer iteration with BigInt instead.
ツールくん

Side Note — Fibonacci, the golden ratio, and Binet's formula

The sequence was popularised in Europe by Leonardo of Pisa (Fibonacci) in his 1202 book Liber Abaci, where he used it to model rabbit population growth. However, equivalent sequences appeared in Indian mathematics as early as 200 BCE in the work of Pingala, who studied poetic meter.

The golden ratio φ = (1 + √5) / 2 ≈ 1.618 satisfies φ² = φ + 1, which is the key to why Fibonacci numbers converge to it. Binet's formula gives F(n) exactly: F(n) = (φⁿ − ψⁿ) / √5, where ψ = (1 − √5) / 2 ≈ −0.618. This closed-form expression lets you compute any Fibonacci number directly, without iterating.