What this calculator does
The Fibonacci Sequence Calculator generates the first n numbers of the Fibonacci sequence, where each term is the sum of the two before it. You simply tell it how many terms you want, and it returns the full list along with handy extras: the total length, the sum of all terms, the last value, and the nth term itself. It's a fast way to check homework, test code, or explore the pattern that appears throughout maths and nature.
The input field
- Number of Fibonacci terms: how many numbers you want in the sequence.
One important rule: the count is clamped to a valid range. If you enter less than 1 it becomes 1, and the maximum allowed is 100. So any value you type is automatically kept between 1 and 100 before the sequence is built.
The formula
The sequence is defined by the recurrence:
$$F_n = F_{n-1} + F_{n-2}$$
The calculator seeds the series with the standard starting values \(F_1 = 0\) and \(F_2 = 1\). From the third term onward, every number is simply the previous two added together. (Note: this tool uses the 0-based convention, beginning 0, 1, 1, 2, … rather than 1, 1, 2, …)
Worked example
Suppose you request 8 terms. The calculator starts with 0 and 1, then keeps adding the last two values:
- 0, 1, 1, 2, 3, 5, 8, 13
- Length: 8 terms
- Sum: \(0 + 1 + 1 + 2 + 3 + 5 + 8 + 13 = 33\)
- Last (8th) term: 13
That 13 is also reported as the "nth term" because it sits in position 8 of the list.
Fibonacci Numbers Reference Table (F1–F20 and Selected Larger Terms)
This calculator lists terms starting from 0, so the 1st term is 0 and the 2nd is 1. In the table, n is the position of the term in the list (1-based position, F1 = 0, F2 = 1). In the more common mathematical indexing (F0 = 0, F1 = 1), the term at position n is Fn−1. The cumulative sum of the first n terms equals Fn+1 − 1 in that standard indexing.
| n (position) | Term value | Sum of first n terms |
|---|---|---|
| 1 | 0 | 0 |
| 2 | 1 | 1 |
| 3 | 1 | 2 |
| 4 | 2 | 4 |
| 5 | 3 | 7 |
| 6 | 5 | 12 |
| 7 | 8 | 20 |
| 8 | 13 | 33 |
| 9 | 21 | 54 |
| 10 | 34 | 88 |
| 11 | 55 | 143 |
| 12 | 89 | 232 |
| 13 | 144 | 376 |
| 14 | 233 | 609 |
| 15 | 377 | 986 |
| 16 | 610 | 1596 |
| 17 | 987 | 2583 |
| 18 | 1597 | 4180 |
| 19 | 2584 | 6764 |
| 20 | 4181 | 10945 |
Selected larger checkpoints
| n (position in this tool's list) | Standard index | Term value |
|---|---|---|
| 30 | F29 | 514229 |
| 50 | F49 | 7778742049 |
| 100 | F99 | 218922995834555169026 |
Note: with other indexing conventions the same numbers carry different labels. For example, the value 514229 is F29 in the standard 0, 1, 1, 2 indexing, but it is the 30th term when you count positions starting from 1.
Key Terms and Indexing Conventions
- Fibonacci sequence: an integer sequence in which each term is the sum of the two terms before it: 0, 1, 1, 2, 3, 5, 8, 13, …
- Term / index n: a term is one number in the sequence; the index tells you its position. In this calculator, n is the total number of terms to generate.
- Recurrence relation: the rule that defines each term from earlier ones. Here \(F_k = F_{k-1} + F_{k-2}\).
- Seed values: the starting terms that the recurrence needs. This tool uses \(F_0 = 0\) and \(F_1 = 1\).
- 0-based vs 1-based convention: the sequence 0, 1, 1, 2, 3, … starts with F0 = 0. Many textbooks instead start 1, 1, 2, 3, … with F1 = F2 = 1 (the leading 0 is dropped). The mapping is: the k-th term of the 1, 1, 2 sequence equals the (k−1)-th term of the 0, 1, 1, 2 sequence in standard indexing, i.e. the same value, with the 0 simply omitted. Counting positions from 1 in the list 0, 1, 1, 2, …, position n holds Fn−1.
- Golden ratio φ: \(\varphi = \frac{1+\sqrt{5}}{2} \approx 1.6180339887\). The ratio of consecutive terms \(F_{k+1}/F_k\) approaches φ as k grows, for example 13/8 = 1.625, 21/13 ≈ 1.6154, 34/21 ≈ 1.6190.
- Sum of first n terms: in the 1, 1, 2, 3, … convention (F1 = F2 = 1), \(F_1 + F_2 + \dots + F_n = F_{n+2} - 1\). For example, with n = 5: 1 + 1 + 2 + 3 + 5 = 12 = F7 − 1 = 13 − 1. In the 0, 1, 1, 2 list of this tool, the sum of the first n terms is Fn+1 − 1 in standard indexing, because the leading 0 adds nothing but shifts the count by one.
How to Compute the Sequence by Hand
- Write the seeds: 0 and 1. These are the first two terms.
- Add the last two terms you have written to get the next term. From 0 and 1, the next term is 0 + 1 = 1.
- Repeat step 2 until you have listed n terms. For example, 1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8, 5 + 8 = 13.
- Keep a running total if you need the sum: add each new term to the previous total. For n = 7 (0, 1, 1, 2, 3, 5, 8): 0 + 1 + 1 + 2 + 3 + 5 + 8 = 20.
- Check the last term: confirm it equals the sum of the two terms before it. Also, the sum of the first n terms should equal the term two places further on, minus 1 (here the next two terms would be 13 and 21, and 21 − 1 = 20).
Iterative approach (pseudocode-style)
Set a = 0 and b = 1. Repeat n times: output a, then set the pair (a, b) to (b, a + b). This uses only additions, needs just two stored values, and is exact as long as the integers fit in your number type (arbitrary-precision integers handle any size).
Closed form (Binet's formula)
With standard indexing (F0 = 0, F1 = 1), a closed form exists:
$$F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}}, \quad \varphi = \frac{1+\sqrt{5}}{2}, \quad \psi = \frac{1-\sqrt{5}}{2}$$It is elegant and lets you jump straight to one term, but it relies on irrational numbers. In ordinary floating-point arithmetic, rounding errors build up as n grows (with standard 64-bit doubles, results become unreliable somewhere around n ≈ 70–80, where the values exceed what a double can store exactly). That is why iteration with exact integers is the preferred method for generating a list of terms.
Frequently asked questions
Why does the sequence start with 0? This calculator uses the common computing convention \(F = 0, 1, 1, 2, 3\dots\) If your textbook starts at 1, 1, 2, 3, just ignore the leading 0.
What is the largest sequence I can generate? Up to 100 terms. Anything higher is automatically reduced to 100, and anything below 1 is raised to 1.
How big do the numbers get? Fibonacci numbers grow very quickly—roughly multiplying by 1.618 (the golden ratio) each step—so the 100th term is already a 21-digit number.