The Fibonacci calculator above returns the nth Fibonacci number exactly, prints the sequence up to that point, and shows the ratio between consecutive terms closing in on the golden ratio. It uses BigInt arithmetic throughout, which matters more than it sounds: past the 78th term, ordinary JavaScript numbers stop being exact, and a calculator that ignores this will confidently return a wrong digit somewhere in the middle of a long answer.
Arb Digital builds free tools that stay correct at the edges rather than only in the demo case. This page is about the sequence itself, its growth rate, and the identities that make it worth studying.
What This Fibonacci Calculator Does
Enter a term number and it computes F(n) by iterating the recurrence, which takes n steps and stays exact at every one. It also gives the previous term, the ratio between them, the running sum of the sequence up to that point, and the number of digits in the result — a useful figure once the answers grow past what fits on a line.
The listing shows the sequence from F(0) upward, so the indexing convention is visible rather than assumed. Very large inputs are capped, since a term beyond a few thousand runs to hundreds of digits and stops being useful on screen long before it becomes slow to compute.
How to Use It
- Enter the term number you want. The sequence starts at F(0) = 0, so F(10) is 55 rather than 89.
- Choose how many terms to list. Twenty is enough to see the pattern; sixty shows the growth clearly.
- Read F(n) in the headline box. It is exact to every digit, however long.
- Watch the ratio in the results grid — it converges on 1.618033988… as n grows.
- Follow the steps panel for the recurrence applied to your own value and the identity checks.
The Rule: Each Term Is the Sum of the Two Before It
The definition is F(n) = F(n−1) + F(n−2), with F(0) = 0 and F(1) = 1 as the starting values. Everything else follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, and onwards. Each number is simply the sum of its two predecessors, which makes the sequence trivially easy to extend by hand and surprisingly rich in structure.
The indexing convention is the one thing worth pinning down before comparing answers across sources. This calculator uses F(0) = 0, F(1) = 1, which is the standard modern convention and the one Wolfram MathWorld uses in its entry on the Fibonacci number. Some older texts start at F(1) = 1, F(2) = 1, which shifts every index by one. If a reference disagrees with a result here by exactly one position, that is almost always the reason.
Computing F(20) by the recurrence takes 20 additions: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765. So F(20) = 6765, and the previous term F(19) = 4181. The ratio 6765 ÷ 4181 is 1.618033964…, already matching the golden ratio to seven decimal places.
The Golden Ratio Connection
Divide any Fibonacci number by the one before it and the answer oscillates around, and converges to, φ = (1 + √5) ÷ 2 ≈ 1.6180339887. The early ratios overshoot and undershoot — 1/1 = 1, 2/1 = 2, 3/2 = 1.5, 5/3 = 1.667, 8/5 = 1.6 — but the swing narrows quickly and by the twentieth term the agreement is to seven decimal places.
The reason is Binet's Fibonacci number formula, set out in full by Wolfram MathWorld, which gives a closed form for the sequence with no recursion at all: F(n) = (φⁿ − ψⁿ) ÷ √5, where ψ = (1 − √5) ÷ 2 ≈ −0.618. Because |ψ| is less than 1, the ψⁿ term shrinks toward zero as n grows, so F(n) rapidly approaches φⁿ ÷ √5. The sequence is, in effect, exponential growth at rate φ with a vanishing correction. That is also why the number of digits grows linearly: each term is about 1.618 times the last, so roughly every five terms adds a digit.
Binet's formula is elegant and, on a computer, a trap. It involves irrational numbers, so any floating-point implementation accumulates rounding error and starts producing wrong integers surprisingly early. This calculator uses the recurrence with BigInt instead, which is exact by construction. If you want to explore powers and roots directly, the exponent calculator and the square root calculator handle those.
Why Exactness Needs BigInt
JavaScript numbers are IEEE 754 doubles, which represent integers exactly only up to 2⁵³ − 1, or 9,007,199,254,740,991. F(78) is 8,944,394,323,791,464, which is still inside that range. F(79) is 14,472,334,024,676,221, which is not — and from there on, ordinary arithmetic starts silently rounding. The answer still looks like a whole number, it just has wrong digits in the middle.
This is the kind of failure that never announces itself. Nothing throws an error, no NaN appears, and the result is plausible in magnitude. It is simply incorrect. BigInt, which JavaScript has supported since 2020, holds integers of arbitrary size and does exact arithmetic on them, so F(500) comes back with all 105 of its digits correct. The only cost is that BigInt values cannot be freely mixed with regular numbers, which is why the ratio in the results grid is computed by scaled integer division rather than by dividing two BigInts directly.
Identities Worth Knowing
The sum of the first n Fibonacci numbers has a neat closed form: F(0) + F(1) + … + F(n) = F(n+2) − 1. Adding the terms up to F(20) gives 17710, and F(22) is 17711, so the identity holds. The calculator shows this sum, and checking it against F(n+2) − 1 is a fast way to confirm nothing has gone wrong.
Consecutive Fibonacci numbers are always coprime — their greatest common divisor is 1 — which follows directly from the recurrence via the Euclidean algorithm. More generally, gcd(F(m), F(n)) = F(gcd(m, n)), a strikingly clean result. You can verify small cases with the LCM and GCF calculator.
Divisibility follows the index too: every third Fibonacci number is even, every fourth is divisible by 3, and every fifth by 5. F(n) is divisible by F(m) exactly when n is divisible by m. That pattern makes Fibonacci numbers a standard example when introducing modular arithmetic, and the modulo calculator is useful for checking the remainders involved.
Where the Sequence Actually Appears
Fibonacci's own 1202 example was rabbit population growth under simplified assumptions, which is a poor biological model but a perfect illustration of the recurrence. The genuine biological occurrences are in phyllotaxis: the number of spirals in a sunflower head, a pine cone, or a pineapple is very often a Fibonacci number, because packing seeds at an angle related to the golden ratio distributes them most evenly.
In computing, the sequence is the standard teaching example for recursion, memoisation, and dynamic programming, precisely because the naive recursive version is catastrophically slow — it recomputes the same subproblems exponentially many times — while the iterative version this calculator uses is linear. Fibonacci heaps, Fibonacci search, and certain hashing schemes all use the sequence or the golden ratio directly.
Be cautious with the claims that go further. The golden ratio genuinely appears in mathematics and in some natural growth patterns. Assertions that it governs the proportions of the Parthenon, classical paintings, or ideal facial features are largely retrospective pattern-matching, and the measurements usually only fit if you choose which edges to measure. The mathematics is remarkable enough without the mythology. For growth-rate work of a more ordinary kind, our percentage change calculator is the practical tool.
Arb Digital builds fast, accessible, dependency-free calculators that earn organic search traffic and keep visitors reading. Browse the free library, or tell us what you need.
Browse All Free Tools Talk to Arb DigitalCommon Mistakes to Avoid
- Mixing up the indexing. With F(0) = 0, F(10) is 55. Sources that start at F(1) = 1 shift every index by one position.
- Using floating-point arithmetic past F(78). Doubles stop representing integers exactly at 2⁵³, and the wrong digits appear silently.
- Trusting Binet's formula on a computer. It is exact on paper but accumulates rounding error in floating point, producing wrong integers well before the numbers get large.
- Writing the naive recursion. Recomputing F(n−1) and F(n−2) separately is exponential; iterate or memoise instead.
- Over-claiming the golden ratio. Its appearance in seed spirals is real; its supposed presence in classical architecture and art is mostly selective measurement.
Related Free Tools From Arb Digital
Explore related integer structure with the prime factorization calculator and the LCM and GCF calculator, check remainders with the modulo calculator, and handle rapid growth with the exponent calculator or the factorial calculator. For the irrational constant behind the ratio, see the square root calculator. The free online tools hub lists everything else.
Frequently Asked Questions
A sequence where each term is the sum of the two before it, starting 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55. It is defined by F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
6765, counting from F(0) = 0. The term before it, F(19), is 4181, and dividing the two gives 1.6180339, already very close to the golden ratio.
The ratio of consecutive terms converges to the golden ratio, approximately 1.6180339887. Binet's formula expresses each term directly in powers of that constant, which is why the sequence grows at roughly that rate.
Because JavaScript numbers stop representing integers exactly above 2 to the power 53, which F(79) exceeds. BigInt handles arbitrarily large whole numbers, so every digit of the answer is correct.
It equals F(n+2) minus 1. Adding every term up to F(20) gives 17710, and F(22) is 17711, which confirms the identity.
Modern convention starts at F(0) = 0, F(1) = 1, which is what this calculator uses. Some older texts start at F(1) = 1, F(2) = 1, shifting every index by one place.
Not on a computer. It involves irrational numbers, so floating-point rounding produces incorrect integers well before the terms become large. Iterating the recurrence with exact integer arithmetic is both simpler and reliable.
This tool is provided for educational and general reference use. Always check results against the indexing convention your course or reference uses.