Fibonacci Sequence Generator - First N, Nth Term & Range
Math Calculators
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 |
How to use this tool
- Choose a mode. Select "First N" to list the first N Fibonacci numbers, "Nth Term" to look up a single term, or "Range" to find all Fibonacci numbers between two values.
- Enter your value. Type a whole-number count N (up to 10,000), a whole-number index, or non-negative integer range bounds. Fractional and exponent-form indices are rejected rather than rounded. The result appears immediately.
- Copy or download. Use the Copy or Download buttons to export the sequence as plain text or CSV.
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.
Fibonacci terms in this tool are indexed only by whole numbers. The First N and Nth Term
inputs therefore reject fractional values such as 2.4, blank input, nonnumeric
text, and exponent-form overflow instead of rounding them to a different index. Counts must be
at least 1, and Nth-term indices may start at 0.
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.
Frequently asked questions
What is the Fibonacci sequence?
The Fibonacci sequence is a series of numbers where each term is the sum of the two preceding terms, starting from 0 and 1: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … It appears throughout nature, art, and mathematics.
How does the calculator handle very large Fibonacci numbers?
This calculator uses JavaScript BigInt for all computations, giving exact integer results for any index up to 10,000. The 10,000th Fibonacci number has 2,090 digits. For the Nth-term mode, the value can be copied in full even if the display is truncated.
What is the golden ratio connection?
As Fibonacci numbers grow, the ratio F(n)/F(n−1) converges to the golden ratio φ ≈ 1.6180339887. This ratio is irrational and appears throughout geometry, art, and nature. The ratio column in this calculator shows how quickly the sequence converges.
What algorithm does the calculator use for large indices?
The calculator uses the fast-doubling algorithm, which computes F(n) in O(log n) steps using the identities F(2k) = F(k)(2F(k+1) − F(k)) and F(2k+1) = F(k)² + F(k+1)². This is much faster than naive iteration for large indices.
Why are fractional indices rejected?
The sequence is defined here only at whole-number indices. First-N counts must be positive integers and Nth-term indices must be non-negative integers, so values such as 2.4 are rejected rather than rounded to a different request. The first-N and Nth-term modes are capped at 10,000.
Related tools
- Sequence DetectorTest a list for arithmetic, geometric, Fibonacci-like, or polynomial patterns.
- Number Theory ExplorerInspect divisor and classification properties of generated Fibonacci terms.
- Continued Fraction ConverterExplore rational approximations connected to consecutive Fibonacci ratios.
- SpirographMove from Fibonacci ratios and spirals to interactive geometric curve art.