In this article
In 1202, Leonardo of Pisa, known as Fibonacci, posed a puzzle about rabbits: start with one pair, let every pair that is at least a month old produce a new pair each month, and count the pairs. The answer was a sequence that mathematicians, biologists, traders and programmers still talk about. The rule is so simple that a child can follow it, and the consequences are surprisingly deep.
The rule and the first terms
Start with 0 and 1. Every next number is the sum of the previous two: 0 + 1 = 1, 1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, and so on. Some books start at 1, 1 instead of 0, 1. The numbers after the start are identical.
| n | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F(n) | 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | 89 | 144 |
F(n) is the n-th term. F(10) = 55 and F(12) = 144.
- 1Take the last twoFor example 21 and 34.
- 2Add them21 + 34 = 55.
- 3Slide alongNow the last two are 34 and 55. Repeat.
The rabbit puzzle
Fibonacci’s puzzle assumes immortal rabbits that mate perfectly, so it is a model rather than zoology. Month 1: one pair, too young to breed. Month 2: still one pair, now mature. Month 3: the pair has a new pair, so two. Month 4: the old pair breeds again, the newer pair is maturing, so three. The pairs per month go 1, 1, 2, 3, 5, 8: exactly the sequence.
Each month the population equals last month’s pairs (who survive) plus the pairs born to everyone who was already mature two months ago.
It grows faster than it looks
The early terms are gentle, which hides how quickly the sequence takes off. Roughly every step multiplies the value by 1.618, so it is exponential growth, and the terms soon become huge.
F(90) is already 2,880,067,194,370,816,120, about 2.9 × 10¹⁸.
The curve is flat for the first few terms and then bends steeply upward, the signature of exponential growth.
If that shape looks familiar, it is the same curve you meet in compound growth and the rule of 72. Fibonacci growth is like earning about 61.8% per step, with the nice twist that the “interest” comes from the sequence’s own past.
The golden ratio appears
Divide each term by the one before it and watch what happens. The first ratios jump around (1, 2, 1.5, 1.67), then quickly calm down and approach 1.6180339…, known as the golden ratio and written with the Greek letter phi (φ).
The blue line oscillates around the amber line, getting closer each time. By n = 10 the ratio is correct to three decimals.
Because of this, there is even a direct formula, Binet’s formula: F(n) = (φⁿ − (1 − φ)ⁿ) ÷ √5. Since (1 − φ) is about −0.618, its powers shrink to nothing, so F(n) is simply φⁿ ÷ √5 rounded to the nearest whole number. For n = 10: 1.618¹⁰ ÷ 2.236 ≈ 55.0.
Climbing stairs and counting ways
Here is a puzzle that has nothing to do with rabbits. You can climb a staircase by taking either 1 or 2 steps at a time. How many different routes are there for n steps? The last move was either a single step (leaving n − 1 steps before it) or a double step (leaving n − 2). So ways(n) = ways(n − 1) + ways(n − 2): the Fibonacci rule again.
The count for n stairs is F(n + 1). Twenty stairs already have 10,946 different routes.
Another identity: the sum of the first n terms (from F(1)) is F(n + 2) − 1. Check with the first ten: 1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55 = 143, and F(12) − 1 = 144 − 1 = 143.
Why programmers use it as a warning
Fibonacci is the standard example of recursion, a function that calls itself: fib(n) = fib(n − 1) + fib(n − 2). It is elegant, and it is slow, because the same values are recomputed again and again. fib(5) calls fib(4) and fib(3), and fib(4) calls fib(3) again, and so on.
- Recomputes the same terms repeatedly
- Time roughly doubles with every extra step
- F(40) needs about 331 million calls
- Keeps only the last two values
- Time grows in a straight line with n
- Easily handles F(10,000) with big integers
The number of calls for naive recursion is 2 × F(n + 1) − 1, so the slowness is itself a Fibonacci sequence.
- 1Starta = 0, b = 1.
- 2Repeat 6 timesReplace (a, b) with (b, a + b): (1,1), (1,2), (2,3), (3,5), (5,8), (8,13).
- 3Read the answerAfter 6 rounds, a = 8, which is F(6).
Quick practice
- What comes after 55, 89? 144 (55 + 89).
- How many ways to climb 6 stairs with steps of 1 or 2? F(7) = 13.
- Estimate F(12) with φⁿ ÷ √5: 1.618¹² ≈ 321.99, divided by 2.236 gives 144.0. Rounded: 144.
- Is 1,000,000 a Fibonacci term? No. The terms near it are 832,040 (F(30)) and 1,346,269 (F(31)).
A rule you can say in one breath turns out to describe breeding rabbits, climbing stairs and a ratio that appears all over geometry, while also teaching every new programmer why smart algorithms matter. Try the generator above to see 50 terms in a flash, and notice how fast the numbers grow after the first few. For another kind of number pattern, read about prime numbers.
Questions people ask
What is the Fibonacci sequence?
A sequence in which each number is the sum of the two before it, starting 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55.
What is the golden ratio?
About 1.6180339887, the value that the ratio of consecutive Fibonacci numbers approaches. It equals (1 + √5) ÷ 2.
What is the 10th Fibonacci number?
55, if you count F(0) = 0, F(1) = 1. Counting from F(1) = 1, F(2) = 1, the tenth term is also 55.
Is there a formula for the n-th Fibonacci number?
Yes, Binet’s formula: F(n) = (φⁿ − (1 − φ)ⁿ) ÷ √5. In practice F(n) is φⁿ ÷ √5 rounded to the nearest integer.
Why is recursive Fibonacci slow?
It recomputes the same values many times, so the number of calls grows exponentially. F(30) takes about 2.7 million calls, while a loop needs 30 steps.
Do all flowers follow Fibonacci numbers?
No. Many sunflowers, pinecones and pineapples show Fibonacci counts in their spirals, but it is a common pattern, not a rule.

