Fibonacci and Lucas number calculator
Compute exact Fibonacci or Lucas numbers, list the sequence, or test whether a number belongs to it.
A clear answer. Here’s how.
Terms are computed exactly with BigInt using the fast-doubling identities F(2k) = F(k)(2F(k+1) − F(k)) and F(2k+1) = F(k)² + F(k+1)², and Lucas numbers from L(n) = 2F(n+1) − F(n). Membership is tested with the classic criterion: x is a Fibonacci number exactly when 5x² + 4 or 5x² − 4 is a perfect square, and a Lucas number when 5x² + 20 or 5x² − 20 is, using an exact integer square root. Indexes start at 0, so F(0) = 0, F(1) = F(2) = 1 and L(0) = 2.
How this is checked
5 reference checks passed These 5 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Do nthSequence fibonacciIndex n (from 0) 100
- Expected, and what Toolmoz gave
- F(100) expected 354224848179261915075, Toolmoz 354224848179261915075Digits expected 21, Toolmoz 21
- Where the expected answer comes from
- OEIS A000045: F(100) = 354224848179261915075, summed term by term with exact integers in Python
- Allowed difference
- exact
Case 2
- Inputs
- Do nthSequence fibonacciIndex n (from 0) 90
- Expected, and what Toolmoz gave
- F(90) expected 2880067194370816120, Toolmoz 2880067194370816120
- Where the expected answer comes from
- OEIS A000045: F(90) = 2880067194370816120, the largest Fibonacci number below 2^63
- Allowed difference
- exact
Case 3
- Inputs
- Do nthSequence lucasIndex n (from 0) 10
- Expected, and what Toolmoz gave
- L(10) expected 123, Toolmoz 123
- Where the expected answer comes from
- OEIS A000032: 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123
- Allowed difference
- exact
Case 4
- Inputs
- Do checkSequence fibonacciWhole number to test 144
- Expected, and what Toolmoz gave
- Is a Fibonacci number expected Yes, Toolmoz YesFibonacci index expected 12, Toolmoz 12Is a Lucas number expected No, Toolmoz No
- Where the expected answer comes from
- 144 = F(12) (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144) and is not in 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199
- Allowed difference
- exact
Case 5
- Inputs
- Do checkSequence fibonacciWhole number to test 145
- Expected, and what Toolmoz gave
- Is a Fibonacci number expected No, Toolmoz NoIs a Lucas number expected No, Toolmoz No
- Where the expected answer comes from
- 145 lies between F(12) = 144 and F(13) = 233 and is not a Lucas number
- Allowed difference
- exact
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Do
- Find the nth term
- Sequence
- Fibonacci: 0, 1, 1, 2, 3, 5, …
- Index n (from 0)
- 100
Example result
- F(100)
- 354224848179261915075
- Digits
- 21
- Last 6 digits
- 915075
- Ratio to the previous term
- 1.618034
Computed exactly with the fast-doubling identities F(2k) = F(k)(2F(k+1) − F(k)) and F(2k+1) = F(k)² + F(k+1)²; Lucas numbers use L(n) = 2F(n+1) − F(n). Copy and download give every digit. The ratio of consecutive terms approaches the golden ratio 1.618034.