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
| n | F(n) | F(n)/F(n-1) |
|---|---|---|
| 0 | 0 | - |
| 1 | 1 | - |
| 2 | 1 | 1.0000000000 |
| 3 | 2 | 2.0000000000 |
| 4 | 3 | 1.5000000000 |
| 5 | 5 | 1.6666666667 |
| 6 | 8 | 1.6000000000 |
| 7 | 13 | 1.6250000000 |
| 8 | 21 | 1.6153846154 |
| 9 | 34 | 1.6190476190 |
| 10 | 55 | 1.6176470588 |
| 11 | 89 | 1.6181818182 |
| 12 | 144 | 1.6179775281 |
| 13 | 233 | 1.6180555556 |
| 14 | 377 | 1.6180257511 |
| 15 | 610 | 1.6180371353 |
| 16 | 987 | 1.6180327869 |
| 17 | 1597 | 1.6180344478 |
| 18 | 2584 | 1.6180338134 |
| 19 | 4181 | 1.6180340557 |
| Item | Value |
|---|---|
| F(0) | 0 |
| F(1) | 1 |
| F(2) | 1 |
| F(3) | 2 |
| F(4) | 3 |
| F(5) | 5 |
| F(6) | 8 |
| F(7) | 13 |
| F(8) | 21 |
| F(9) | 34 |
| F(10) | 55 |
| F(11) | 89 |
| F(12) | 144 |
| F(13) | 233 |
| F(14) | 377 |
| F(15) | 610 |
| F(16) | 987 |
| F(17) | 1,597 |
| F(18) | 2,584 |
| F(19) | 4,181 |
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.