Fibonacci Calculator
Exact Fibonacci or Lucas number for any index from 0 to 300, with the terms either side, the running sum, digit count and the ratio's gap from φ.
Fibonacci Calculator
Background.
What is the 100th Fibonacci number? Run the obvious loop with ordinary floating-point numbers, the default in most programming languages, and the number you end up holding is 354,224,848,179,261,997,056. The true value is 354,224,848,179,261,915,075. The first sixteen digits agree and the last five are wrong, and nothing in the faulty answer warns you. That is the practical reason to compute these numbers carefully: they are easy to define and grow fast enough to break ordinary arithmetic surprisingly early.
The definition takes one line. Start with 0 and 1, and make every new term the sum of the two before it: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144. Each term is roughly 1.618 times the one before, so they pass 2⁵³ at F(79). Beyond 2⁵³ a standard double can no longer store every whole number, and an ordinary number type keeps only a nearby value.
Here the recurrence is carried out in whole numbers that are never rounded, so the exact value at the top of the results is correct to the last digit for every index from 0 up to the cap of 300, where F(300) runs to 63 digits. Alongside it you get the same term as an ordinary number, the terms on either side, the total of every term from index 0, the digit count, a preview of the run, and the ratio of the term to its predecessor set against the golden ratio φ.
The Lucas numbers share the calculator. They obey the identical rule but start from 2 and 1, giving 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, and they are named after Édouard Lucas, the nineteenth-century French mathematician who studied both sequences. The two are bound together: any Lucas number equals the sum of the two Fibonacci numbers on either side of the same index.
The sequence is named after Leonardo of Pisa, whose Liber Abaci of 1202 posed a puzzle about breeding rabbits that these numbers answer. Scholars of Sanskrit prosody had counted the same numbers centuries earlier, while listing the rhythms that can be built from long and short syllables.
What is fibonacci calculator?
The Fibonacci numbers are the integers defined by F(0) = 0, F(1) = 1 and F(n) = F(n−1) + F(n−2) for every n of 2 or more. MathWorld defines the sequence from F(1) = F(2) = 1 and adds F(0) = 0 by convention; the OEIS registers it as A000045 with offset 0, the numbering used here. Every term depends on two predecessors rather than one, so the sequence is neither arithmetic nor geometric, yet it has a closed form, Binet's formula F(n) = (φⁿ − ψⁿ) ⁄ √5, where φ = (1 + √5) ⁄ 2 ≈ 1.618 and ψ = (1 − √5) ⁄ 2 ≈ −0.618. Because ψⁿ shrinks toward zero, F(n) is simply the whole number nearest to φⁿ ⁄ √5: for n = 20 that quotient is 6765.00003. The Lucas numbers L(n) use the same rule with L(0) = 2 and L(1) = 1, and their closed form is even simpler, L(n) = φⁿ + ψⁿ.
How to use this calculator.
- Choose Fibonacci or Lucas from the sequence menu. A list beginning 0, 1 or 1, 1 is Fibonacci; one beginning 2, 1, 3, 4 is Lucas.
- Enter the index in Index (n), counting from 0. A textbook that calls the opening 1 the first Fibonacci number still matches this numbering for every index of 1 or more, so its tenth term is F(10) = 55 here as well.
- Copy the exact value when you need every digit. From F(79) upward the As a number line holds only the nearest value a standard double can store, so it drifts from the exact digits.
- Use the previous and next terms to continue the sequence by hand or to test an identity such as Cassini's, and the sum line for the total of every term from index 0 through n.
- Keep the index a whole number from 0 to 300. A fractional index has no term, negative indices are outside the calculator's scope, and anything above 300 is refused rather than shown rounded.
The formula.
The calculation is the definition itself. Starting from the seed pair, F(0) = 0 with F(1) = 1 or L(0) = 2 with L(1) = 1, each step adds the last two terms and shifts along, so reaching index n takes n additions. Working in whole numbers with far more digits than F(300) needs means nothing is ever approximated. Binet's formula would get there in one line, but it passes through irrational numbers and has to be rounded back to an integer at the end, so here it serves only as a cross-check.
The running total follows from rearranging the rule as a(k) = a(k+2) − a(k+1). Adding that for k = 0 to n, almost everything cancels and the sum collapses to a(n+2) − a(1). Both sequences have a(1) = 1, so the terms from index 0 through n always add up to the term two places further on, minus 1. The calculator still adds the terms one by one, which lets the identity act as an independent check.
The ratio a(n) ⁄ a(n−1) heads to φ because ψⁿ dies away in Binet's formula, leaving each term close to φ times the last. It does not approach smoothly from one side: for Fibonacci, an even index gives a ratio just below φ and an odd index one just above, and the gap shrinks by a factor of about φ² ≈ 2.618 at every step. The same growth sets the digit count, which rises by log₁₀ φ ≈ 0.209 per index, so a new digit appears roughly every 4.8 terms: F(50) has 11 digits, F(100) has 21 and F(300) has 63.
Cassini's identity gives a quick test of any three neighbours: F(n−1) × F(n+1) − F(n)² = (−1)ⁿ, so the product of the terms either side differs from the square of the middle one by exactly 1.
A worked example.
Take Fibonacci at index 20. Starting from 0 and 1 and adding the last two terms each time gives 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181 and then 6765, so the exact value is 6765, a 4-digit number. The previous term is 4181, and the next term is 4181 + 6765 = 10946. Adding all twenty-one terms from F(0) to F(20) gives 17710. The shortcut agrees: two places further on, F(22) = 10946 + 6765 = 17711, and 17711 − 1 = 17710. The ratio line divides 6765 by 4181 to get 1.6180339632, which sits 2.558 × 10⁻⁸ below φ = 1.6180339887. Index 20 is even, so the ratio falls just short; at index 21 it overshoots instead. Cassini's identity checks the three neighbours: 4181 × 10946 = 45,765,226 and 6765² = 45,765,225, a difference of exactly 1. The Lucas number at the same index is the sum of the two Fibonacci neighbours, 4181 + 10946 = 15127, which is what the calculator returns with Lucas selected. Multiplying the pair gives 6765 × 15127 = 102,334,155, which is F(40): the identity F(2n) = F(n) × L(n) doubles the index in a single step.
Frequently asked questions.
What is the 100th Fibonacci number?
Does the Fibonacci sequence start at 0 or at 1?
Why does the ratio of consecutive terms approach 1.618?
How can I tell whether a number is a Fibonacci number?
Which Fibonacci numbers are even, and what divides what?
How are Lucas numbers connected to Fibonacci numbers?
Why does the As a number line disagree with the exact value for large indices?
Can the sequence be extended to negative indices?
Why stop at index 300?
Where do Fibonacci numbers turn up outside textbooks?
References& sources.
- [1]Wolfram MathWorld, 'Fibonacci Number' — the recurrence F_n = F_(n−1) + F_(n−2) with F₁ = F₂ = 1 and F₀ = 0 by convention (eq. 1); Binet's formula (eq. 6); the summation identity Σ_(k=1)^(n) F_k = F_(n+2) − 1 (eq. 22); and lim F_n/F_(n−1) = φ (eq. 78, first proved by Robert Simson in 1753). Retrieved 2026-07-29; open access.
- [2]Wolfram MathWorld, 'Lucas Number' — L_n = L_(n−1) + L_(n−2) with L₁ = 1 and L₂ = 3 (which forces L₀ = 2), and the printed run 1, 3, 4, 7, 11, 18, 29, 47, 76, 123. Retrieved 2026-07-29; open access.
- [3]Encyclopedia of Mathematics (European Mathematical Society), 'Fibonacci numbers' — independent check: u₁ = u₂ = 1 with u_(n+1) = u_n + u_(n−1); the Binet closed form; lim u_(n+1)/u_n = φ; and the Lucas companion with v₀ = 2, v₁ = 1. Confirms F(20) = 6765 and the Lucas seeds used here. Retrieved 2026-07-29; open access.
- [4]NIST Digital Library of Mathematical Functions, §5.2(ii), equation 5.2.3 — the digit discipline used for irrational constants on Quanta's sequence pages; φ is quoted to the same standard. Retrieved 2026-07-29; open access.
- [5]OEIS Foundation, sequences A000045 (Fibonacci) and A000032 (Lucas) — the canonical index registrations, both with offset 0. Listed for the reader's reference only: oeis.org returned HTTP 403 to this session, so the 0-based offsets were confirmed against MathWorld and the Encyclopedia of Mathematics instead and nothing on this page depends on this entry alone.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 5 cited below
- Method
- F(n) = F(n−1) + F(n−2), F(0) = 0, F(1) = 1
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled