Enter the number of terms (how far to go) and press "Calculate". You get the first few terms of the Fibonacci sequence (1, 1, 2, 3, 5, 8, …), the nth term and the sum of the first n terms at once.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and graphs
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter just one value, the number of terms (how far to go), to get the \(n\)th term of the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, …) and the sum of the first \(n\) terms at once
- Works directly for questions like "What is the 20th Fibonacci number? What do the first 20 add up to?"
- Calculates exact values, with every digit, all the way up to term 1000 (a 209-digit number)
- Along with the result, a graph shows how the Fibonacci sequence grows, with each term being the sum of the two terms before it
- A plain-language explanation of the formula (the recurrence relation) and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
The Fibonacci sequence follows the simple rule "add the two previous terms", so it is a classic exercise for learning loops and recursion (a function that calls itself) in intro programming. The same answer can take very different amounts of time depending on how you write the code (plain recursion needs a huge number of calls to reach term 50), so it is also popular in algorithms classes.
There are also a data structure (the Fibonacci heap) and a search method (Fibonacci search) named after it, making it one of the basic terms of computer science.
It has been proven that the ratio of neighboring Fibonacci numbers (later ÷ earlier) gets closer to the golden ratio \(\varphi = 1.618\cdots\) the further you go. In fact, \(55 \div 34 \approx 1.6176\) and \(89 \div 55 \approx 1.6182\), so by around term 10 they already match to 2 decimal places.
The golden ratio is sometimes used in design as a well-balanced ratio. For example, the shape of a credit card is often said to be close to it. That the golden ratio appears from a sequence built only by adding whole numbers is the most beautiful property of the Fibonacci sequence.
The Fibonacci sequence comes from a problem in the book Liber Abaci by the 13th-century Italian mathematician Fibonacci: "A newborn pair of rabbits starts having one new pair every month once it is 2 months old. How does the number of pairs change month by month?" The number of pairs each month grows as 1, 1, 2, 3, 5, 8, …, reaching 144 pairs in month 12.
Of course, real rabbits do not multiply exactly this way; it is an idealized model. Still, it became the starting point for describing with sequences how an amount grows depending on the amounts a little earlier.
In agile software development, it is common to estimate work with numbers based on the Fibonacci sequence, such as 1, 2, 3, 5, 8, 13, … (called story points).
The gaps grow as the numbers get larger, which fits the reality that bigger tasks cannot be estimated precisely. It also avoids pointlessly fine debates such as "is this an 8 or a 9?".
Many examples have been reported where the number of spirals is a Fibonacci number (8, 13, 21, 34, 55, …), such as the spirals of seeds in a sunflower (for example, 34 one way and 55 the other) and the spirals of scales on pine cones and pineapples. This pattern is explained by how plants grow: new buds and seeds form in directions that do not overlap the parts already there.
Not every plant or specimen follows it, though. It is known as a tendency: many examples turn out to be Fibonacci numbers. Try counting the spirals on a plant near you, and you may meet this sequence.
Formulas and graphs
Symbols and terms
Symbols
| \(n\) | en | The number of terms. A positive whole number that says how far along the sequence you go. "Up to term 10" is \(n = 10\). |
| \(a_n\) | a sub n | The \(n\)th term. The \(n\)th number of the sequence. The small letter at the lower right (the subscript) tells which position it is. In the Fibonacci sequence, \(a_1 = 1,\ a_2 = 1,\ a_3 = 2,\ a_4 = 3, \cdots\). |
| \(a_{n-1}\) | a sub n minus one | The term just before the \(n\)th term (one back). For term 10, it is term 9. The subtraction inside the subscript says "one position earlier". |
| \(a_{n-2}\) | a sub n minus two | The term two before the \(n\)th term. For term 10, it is term 8. |
| \(a_{n+2}\) | a sub n plus two | The term two ahead of the \(n\)th term. For term 10, it is term 12. The sum of terms 1 through \(n\) equals this term minus \(1\). |
| \(S_n\) | S sub n | The sum of terms 1 through \(n\). A short way to write \(a_1 + a_2 + \cdots + a_n\). The letter S comes from "sum". |
| \(\varphi\) | phi | The symbol for the golden ratio. Its value is \(\varphi = \dfrac{1 + \sqrt{5}}{2} = 1.618\cdots\). The ratio of neighboring Fibonacci numbers (later ÷ earlier) gets closer to this value the further you go. |
| \(\cdots\) | dot dot dot (ellipsis) | A symbol that says the pattern continues the same way. Writing 1, 1, 2, 3, 5, 8, … says the sequence keeps going by adding the two previous terms. |
Terms
| sequence | A list of numbers in a set order. Each number in the list is called a term. |
| Fibonacci sequence | A sequence that starts with 1, 1 and then continues by the rule "each term is the sum of the two terms before it", giving 1, 1, 2, 3, 5, 8, 13, 21, …. It comes from a problem about how pairs of rabbits multiply, which the 13th-century Italian mathematician Fibonacci described in his book. Each number in it is called a Fibonacci number. |
| term | Each single number in a sequence. From the start, they are called term 1, term 2, and so on. |
| first term | The very first term of a sequence, that is, term 1. In the Fibonacci sequence (as counted on this page), it is 1. |
| recurrence relation (recursive formula) | A formula that describes a sequence as "a rule that gets the next term from earlier terms". The recurrence relation of the Fibonacci sequence is \(a_n = a_{n-1} + a_{n-2}\). Recursive formulas are taught in Algebra 1 and Algebra 2. |
| initial conditions | The values of the first terms, given together with a recurrence relation. For the Fibonacci sequence, the initial conditions are \(a_1 = 1,\ a_2 = 1\). Without them, the recurrence relation alone does not fix the sequence. |
| golden ratio | The ratio \(1 : \dfrac{1 + \sqrt{5}}{2}\) (about \(1 : 1.618\)). Since ancient times it has been seen as a well-balanced ratio, and it is written with the symbol \(\varphi\) (phi). It has been proven that the ratio of neighboring Fibonacci numbers gets closer to the golden ratio the further you go. |
| general term | The \(n\)th term written as a formula in \(n\) (an explicit formula). The Fibonacci sequence also has one that uses the golden ratio \(\varphi\), called Binet's formula. It contains \(\sqrt{5}\) and is a bit complex, so if you only need the value, adding step by step with the recurrence relation is more reliable. |
| arithmetic sequence | A sequence where the difference between neighboring terms is always the same, such as 5, 8, 11, 14, … (add 3 each time). An arithmetic sequence adds a fixed number, while the Fibonacci sequence adds the two previous terms. |
| geometric sequence | A sequence where the ratio between neighboring terms is always the same, such as 3, 6, 12, 24, … (multiply by 2 each time). The Fibonacci sequence is not a geometric sequence, but further along it grows by an almost constant factor of about 1.618, so it behaves much like one. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to review these topics is the fastest way forward.
| Adding whole numbers (Grades 2–3) |
|
| Number patterns (Grades 4–5) |
|
| Variables and expressions (Grade 6) |
|
| Sequence notation (Algebra 1 and 2) |
|
How to calculate it in Excel
| Term 1 | 1 |
| Term 2 | 1 |
| Term 3 | =B1+B2 |
| Term 4 | =B2+B3 |
| Term 5 | =B3+B4 |
| Term 6 | =B4+B5 |
| Term 7 | =B5+B6 |
| Term 8 | =B6+B7 |
| Term 9 | =B7+B8 |
| Term 10 | =B8+B9 |
| Term 1 | 1 |
| Term 2 | 1 |
| Term 3 | =B1+B2 |
| Term 4 | =B2+B3 |
| Term 5 | =B3+B4 |
| Term 6 | =B4+B5 |
| Term 7 | =B5+B6 |
| Term 8 | =B6+B7 |
| Term 9 | =B7+B8 |
| Term 10 | =B8+B9 |
| Sum of terms 1 through 10 | =SUM(B1:B10) |
The first table shows 55 (term 10) in B10, and the second table shows 143 (the sum up to term 10) in B11. To get terms further along, select the bottom "=B8+B9" cell and drag the small square at its lower right corner downward. The same rule continues (the recurrence relation "add the two previous terms" is exactly the cell formula).
How to calculate it in Google Sheets
| Term 1 | 1 |
| Term 2 | 1 |
| Term 3 | =B1+B2 |
| Term 4 | =B2+B3 |
| Term 5 | =B3+B4 |
| Term 6 | =B4+B5 |
| Term 7 | =B5+B6 |
| Term 8 | =B6+B7 |
| Term 9 | =B7+B8 |
| Term 10 | =B8+B9 |
| Term 1 | 1 |
| Term 2 | 1 |
| Term 3 | =B1+B2 |
| Term 4 | =B2+B3 |
| Term 5 | =B3+B4 |
| Term 6 | =B4+B5 |
| Term 7 | =B5+B6 |
| Term 8 | =B6+B7 |
| Term 9 | =B7+B8 |
| Term 10 | =B8+B9 |
| Sum of terms 1 through 10 | =SUM(B1:B10) |
How to calculate it in Python
number_of_terms = 10 # number of terms (how far to go)
# Fibonacci sequence: the first two terms are 1, then each term is the sum of the two before it
fibonacci = [1, 1]
while len(fibonacci) < number_of_terms:
fibonacci.append(fibonacci[-1] + fibonacci[-2])
fibonacci = fibonacci[:number_of_terms]
nth_term = fibonacci[-1] # nth term
sum_of_terms = sum(fibonacci) # sum of terms 1 through n
print(f"First terms: {fibonacci[:10]}")
print(f"Term {number_of_terms}: {nth_term}")
print(f"Sum of terms 1 through {number_of_terms}: {sum_of_terms}")
How to write it in LaTeX and other math languages (copy and paste)
aₙ = aₙ₋₁ + aₙ₋₂
a_n = a_{n-1} + a_{n-2} \quad (n \geq 3,\ a_1 = a_2 = 1)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>a</mi><mi>n</mi></msub>
<mo>=</mo>
<msub><mi>a</mi><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow></msub>
<mo>+</mo>
<msub><mi>a</mi><mrow><mi>n</mi><mo>−</mo><mn>2</mn></mrow></msub>
</mrow>
</math>
a_n = a_(n-1) + a_(n-2)
a[n] == a[n - 1] + a[n - 2]
a(n) := a(n - 1) + a(n - 2);
a(n) = a(n - 1) + a(n - 2);
a_n = a_(n-1) + a_(n-2)
Sₙ = aₙ₊₂ − 1
S_n = a_{n+2} - 1
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>S</mi><mi>n</mi></msub>
<mo>=</mo>
<msub><mi>a</mi><mrow><mi>n</mi><mo>+</mo><mn>2</mn></mrow></msub>
<mo>−</mo>
<mn>1</mn>
</mrow>
</math>
S_n = a_(n+2) - 1
Fibonacci[n + 2] - 1
Sn := a(n + 2) - 1;
S_n = a(n + 2) - 1;
S_n = a_(n+2) - 1
How to have ChatGPT do the calculation
You are an assistant for Fibonacci sequence calculations. Do the following calculations by actually running Python code, and base your answer only on the numbers from the output (do not answer from mental math or guesses). Define the Fibonacci sequence by a_1 = 1, a_2 = 1, a_n = a_(n-1) + a_(n-2) (n ≥ 3). Find each sum by actually adding the terms, and also check that it matches the property S_n = a_(n+2) - 1. 1. Term 10 of the Fibonacci sequence and the sum of terms 1 through 10 2. Term 20 of the Fibonacci sequence and the sum of terms 1 through 20 3. Term 50 of the Fibonacci sequence, and term 50 divided by term 49 (also check that it is close to the golden ratio 1.6180…) Show the formulas you used and the numbers from the output.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
