Fibonacci Calculator — Nth Term and Sequence
Enter a position N to get the exact Fibonacci number at that term, or switch to sequence mode to display the first N numbers in the Fibonacci series. Uses arbitrary-precision integers so results are always exact.
Enter a number N above to compute.
How it works
The Fibonacci sequence: definition and history
The Fibonacci sequence is defined by two simple rules: the first two terms are 0 and 1, and every subsequent term is the sum of the two preceding terms. This gives the series 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, … The rule is deceptively simple, yet the numbers appear across mathematics, computer science, and nature in ways that have fascinated scholars for centuries.
The sequence is named after Leonardo of Pisa, known as Fibonacci, who introduced it to Western Europe in his 1202 book Liber Abaci as a model for rabbit population growth. However, the sequence had been described centuries earlier by Indian mathematicians studying Sanskrit prosody — Virahanka, Gopala, and Hemachandra all identified it while counting patterns of syllables. The sequence is therefore one of the oldest known integer sequences.
The ratio of successive Fibonacci numbers converges to the golden ratio φ ≈ 1.61803…, an irrational number with deep connections to geometry, art, and aesthetics. As N grows, F(N+1) / F(N) approaches φ ever more closely. This convergence explains why Fibonacci spirals appear in sunflower seed arrangements, pine cone spirals, and nautilus shells — these forms grow in ways that minimize material while maximizing packing efficiency.
Computing large Fibonacci numbers accurately
JavaScript's standard Number type stores 64-bit floating-point values, which can represent integers exactly only up to 2^53 ≈ 9 quadrillion. Fibonacci numbers grow exponentially — F(79) already exceeds 2^53 — so naive floating-point arithmetic gives incorrect results for large N. This tool uses JavaScript's built-in BigInt type, which supports integers of arbitrary size limited only by available memory, ensuring every result from F(1) to F(100) is exact.
F(100) is 354,224,848,179,261,915,075 — a 21-digit number. For comparison, the estimated number of atoms in the observable universe is roughly 10^80, and F(382) ≈ 10^79. Fibonacci numbers grow roughly as φ^N / √5, so each additional term is about 61.8% larger than the one before.
There are closed-form formulas for Fibonacci numbers (Binet's formula uses powers of the golden ratio), but they require arbitrary-precision arithmetic to be exact for large N because φ is irrational. The iterative method this tool uses — simply adding consecutive terms — is both exact and efficient for N up to a few thousand.
Applications of Fibonacci numbers
In computer science, Fibonacci numbers appear in algorithm analysis. The worst-case input for the Euclidean algorithm (computing GCD) is consecutive Fibonacci numbers. Fibonacci heaps, a data structure used in Dijkstra's shortest-path algorithm, are named after the sequence because of bounds on their structure. Fibonacci search is also used as a divide-and-conquer search strategy.
In software engineering, Fibonacci numbers are widely used in Agile development as story point scales: 1, 2, 3, 5, 8, 13. The non-linear spacing reflects the increasing uncertainty in estimating larger tasks — adjacent Fibonacci numbers differ by a noticeable margin that forces estimators to commit to one side of an ambiguous choice, which reduces false precision.
In nature, phyllotaxis — the arrangement of leaves, petals, and seeds on a plant — often follows Fibonacci numbers. Sunflowers typically have 55 clockwise and 89 counterclockwise spirals; artichokes have 8 and 13. This arrangement emerges from the plant's growth pattern of adding new organs at the golden angle (≈137.5°) from the previous one, which is directly related to the golden ratio φ.
Frequently asked questions
›What is F(0) — is it 0 or 1?
By the most common modern convention (used here), F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2, … Some older texts start the sequence at F(1) = 1, F(2) = 1, which shifts all indices by one.
›Why does this tool cap at N = 100?
F(100) is already a 21-digit number. Beyond 100, the values become very long strings with limited practical use in this context. If you need values beyond F(100), the iterative BigInt logic can be extended — the algorithm is the same.
›Are the results exact for large N?
Yes. The tool uses JavaScript BigInt, which handles integers of arbitrary size without floating-point rounding errors. Every result from F(1) to F(100) is mathematically exact.
›What is the golden ratio and how does it relate to Fibonacci?
The golden ratio φ ≈ 1.61803… is the positive root of x² = x + 1. The ratio of consecutive Fibonacci numbers F(N+1)/F(N) converges to φ as N increases. F(20)/F(19) = 6765/4181 ≈ 1.61803, already accurate to 5 decimal places.
›Is the Fibonacci sequence the same as the Lucas numbers?
No. Lucas numbers use the same recurrence (each term is the sum of the two before it) but start with L(0) = 2 and L(1) = 1, giving 2, 1, 3, 4, 7, 11, 18, … They share many properties with Fibonacci numbers and both converge to φ.
›Where do Fibonacci numbers appear in nature?
Fibonacci numbers appear in the spiral counts of sunflowers (typically 55 and 89), pinecones (typically 8 and 13), and pineapples. This occurs because plants add new organs at an angle of approximately 137.5° (the golden angle), which is derived from φ and produces optimal packing.
›How fast do Fibonacci numbers grow?
Fibonacci numbers grow exponentially, approximately as φ^N / √5. Each term is about 1.618× the previous one. F(10) = 55, F(20) = 6,765, F(50) = 12,586,269,025, F(100) = 354,224,848,179,261,915,075.
›Why are Fibonacci numbers used in Agile story points?
The Fibonacci scale (1, 2, 3, 5, 8, 13, 21) is used because the gaps between adjacent values grow, forcing teams to distinguish 'medium' from 'large' tasks. This non-linear spacing reduces false precision when estimating work that is inherently uncertain.
Related tools
Last updated: