piapia123
en

Fibonacci Sequence

Generators

Everything runs locally in your browser — nothing is uploaded

Output

Each term is the sum of the previous two: 0, 1, 1, 2, 3, 5, 8, 13… Indexing starts at 0: F(0) = 0 and F(1) = 1. Two conventions circulate — “F(1) = 1, F(2) = 1” and “F(0) = 0, F(1) = 1” — and the same “tenth term” is off by one between them. That matters: when the sequence is used for index arithmetic, being one out is being wrong. This tool uses the internationally standard zero-based convention (ISO 80000-2) and writes the index on every row (`F(10)`), so you can see at a glance which convention you are looking at. Why BigInt is required. F(79) is already close to 2⁵³ and F(80) passes it — after which ordinary numbers silently drop the low digits: F(100) computed as a double gives 354224848179262000000, while the correct value is 354224848179261915075. Same number of digits, same leading digits, nothing looks wrong. And a Fibonacci sequence is exactly the kind of thing people casually compute to the hundredth term. The lookup mode answers the question in the other direction: is this number in the sequence, and if so, which term is it?

Features

  • Four modes: first N terms, the Nth term, terms a to b, and reverse lookup
  • Zero-based indexing, with the index printed on every row so the convention is never ambiguous
  • Change the first two terms (default 0, 1) — enter 2, 1 for the Lucas numbers (2, 1, 3, 4, 7, 11…)
  • BigInt throughout: term 1000 and its 209 digits, and up to term 10000, are exact
  • Lookup tells you which two terms a number falls between when it is not a Fibonacci number
  • Lookup accepts thousands separators and spaces
  • A reversed range (a > b) still works
  • At most 500 rows at a time, and anything left out is reported rather than dropped
  • Every row can be copied on its own

How to use

  1. Choose the mode: first N, the Nth term, a range, or a lookup
  2. Fill in the corresponding value
  3. The result appears as you type; copy a single term from its row

FAQ

Is F(1) equal to 1 or to 0?
It depends on the convention. This tool uses F(0) = 0 and F(1) = 1, the ISO 80000-2 convention and the one most programming texts use. The other common convention starts at F(1) = F(2) = 1. The sequence itself is identical; only the numbering shifts by one. That is why every row here carries its index in the label (`F(10)`) — you can see immediately whether the 55 you got is the tenth term or the eleventh.
Why do ordinary numbers give the wrong answer?
Because a JavaScript number is a double-precision float with 53 significant bits: F(80) = 23416728348467685 is already past that, so converting it gives 23416728348467684. What makes it worse is that nothing errors or throws — it is just quietly one less. This tool uses BigInt end to end, so any number of digits is exact.
How far can it go?
The index limit is 10000 (F(10000) has 2090 digits, far more than fits on a screen). The limit is about the output: beyond it, both the result area and anything you copy become unusable. Lookup searches within the same limit, and a number beyond it is reported as not in the sequence rather than silently treated as searched.

Related tools