Skip to content
Toolcroft

Math Calculators

Fibonacci Sequence Generator - First N, Nth Term & Range

Generate Fibonacci numbers three ways: list the first N terms, look up the exact Nth Fibonacci number (up to F(10,000) using BigInt), or find all Fibonacci numbers within a numeric range. Includes the golden ratio convergence column.

Count

20

Largest term

4181

20 terms

nF(n)F(n)/F(n-1)
00-
11-
211.0000000000
322.0000000000
431.5000000000
551.6666666667
681.6000000000
7131.6250000000
8211.6153846154
9341.6190476190
10551.6176470588
11891.6181818182
121441.6179775281
132331.6180555556
143771.6180257511
156101.6180371353
169871.6180327869
1715971.6180344478
1825841.6180338134
1941811.6180340557

What is the Fibonacci sequence?

The Fibonacci sequence is defined by F(0) = 0, F(1) = 1, and F(n) = F(n−1) + F(n−2) for n ≥ 2. Named after the Italian mathematician Leonardo of Pisa (Fibonacci), the sequence appears throughout mathematics and nature: in the branching of trees, the arrangement of leaves, and the spiral patterns of shells.

Fast-doubling algorithm

Computing F(n) naively requires iterating through all n terms. The fast-doubling algorithm computes F(n) in O(log n) BigInt multiplications using two identities: F(2k) = F(k)(2F(k+1) − F(k)) and F(2k+1) = F(k)² + F(k+1)². This makes computing F(10,000) (which has 2,090 decimal digits), nearly instantaneous in the browser.

The golden ratio

As n grows, the ratio F(n)/F(n−1) converges to the golden ratio φ = (1 + √5)/2 ≈ 1.6180339887…. This irrational number appears throughout geometry, architecture, and art. The ratio column in the table shows how quickly the Fibonacci sequence approximates φ.

Fibonacci in nature

Fibonacci numbers appear throughout the natural world as solutions to optimal packing problems:

  • Phyllotaxis: the spiral arrangement of leaves, seeds, and petals in plants follows Fibonacci numbers to maximize exposure to sunlight and space.
  • Sunflower spirals: the seeds of a sunflower head form two interlocking spiral patterns - typically 34 clockwise and 55 counterclockwise, or 55 and 89.
  • Pinecone scales: scales are arranged in 8 and 13 spirals, or 13 and 21 spirals depending on species.
  • Nautilus shell: the chambers of a nautilus grow at a ratio approximating the golden ratio, forming a logarithmic spiral.

Applications in technology

  • Fibonacci heaps: a data structure with amortized O(log n) decrease-key and delete operations, used in Dijkstra's and Prim's algorithms.
  • Fibonacci search: a divide-and-conquer search algorithm that splits arrays using Fibonacci numbers instead of halves.
  • Fibonacci retracement: a technical analysis tool in trading that uses ratios derived from the golden ratio (23.6%, 38.2%, 61.8%) to identify potential support and resistance levels.

Lucas numbers

The Lucas sequence (2, 1, 3, 4, 7, 11, 18, 29…) uses the same recurrence relation as Fibonacci (L(n) = L(n−1) + L(n−2)) but starts with L(0) = 2 and L(1) = 1. Like Fibonacci numbers, successive Lucas numbers converge to the golden ratio, and the two sequences share deep mathematical relationships: F(n) = L(n−1) + L(n+1) divided by 5.