The Fibonacci Numbers and Their Hidden Divisibility Patterns
Discover which Fibonacci numbers divide which, why remainders repeat in cycles, and what is still unknown about primes in the sequence.
Key takeaways
- With F(0) = 0 and F(1) = 1, the identity gcd(F(m), F(n)) = F(gcd(m, n)) holds for all positive m and n.
- If m divides n, then F(m) divides F(n).
- Remainders of Fibonacci numbers modulo any integer repeat in a cycle, so every positive integer divides infinitely many of them.
- A Fibonacci number with index above 4 can be prime only if its index is prime, though many prime indices give composite numbers.
The Fibonacci numbers begin 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and each term after the first two is the sum of the two before it. Although the rule involves only addition, the sequence has a remarkably orderly pattern of divisors: every third term is even, every fourth is divisible by 3, every fifth by 5, and so on.
The reason is a single identity. The greatest common divisor of two Fibonacci numbers is itself a Fibonacci number, and you find which one by taking the greatest common divisor of their positions.
The sequence and its index
Write F(n) for the term in position n, with F(0) = 0.
| n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| F(n) | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 |
| n | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|
| F(n) | 89 | 144 | 233 | 377 | 610 | 987 | 1597 | 2584 | 4181 | 6765 |
The numbers are named for Leonardo of Pisa, called Fibonacci, who included a rabbit-breeding puzzle producing them in his book of 1202. They had appeared earlier in Indian studies of poetic meter. See the Liber Abaci for the wider story.
Every kth term shares a factor
Look at positions 3, 6, 9, 12 and 15: the values 2, 8, 34, 144 and 610 are all even. At positions 4, 8, 12, 16 and 20 the values 3, 21, 144, 987 and 6765 are all divisible by 3. At 6, 12 and 18, the values 8, 144 and 2584 are all divisible by 8.
In general F(m) divides F(km). The reason is an addition formula:
F(m + n) = F(m) · F(n + 1) + F(m − 1) · F(n) Set n = m. Both terms on the right contain F(m), so F(m) divides F(2m). Set n = 2m, and since F(m) divides F(2m) it divides F(3m). Continuing by induction gives every multiple. For m ≥ 3 the converse also holds: F(m) divides F(n) only if m divides n.
The greatest common divisor identity
Neighboring terms are coprime, because any common divisor of F(n) and F(n + 1) also divides their difference F(n − 1), and walking back you reach 1.
Now take the addition formula and look at gcd(F(m), F(m + n)). The first term on the right is a multiple of F(m). Since F(m − 1) is coprime to F(m), what remains is gcd(F(m), F(n)). So you may subtract one index from the other, exactly as in the Euclidean algorithm. Repeating leads to the greatest common divisor of the indices.
Test it: gcd(F(12), F(18)) = gcd(144, 2584). The indices have gcd 6, and F(6) = 8. Indeed 144 = 8 × 18 and 2584 = 8 × 323, with gcd(18, 323) = 1.
A bonus: infinitely many primes
The identity gives a pleasant proof that the primes never run out. Take two different odd primes p and q. Their indices are coprime, so
gcd(F(p), F(q)) = F(gcd(p, q)) = F(1) = 1 The numbers F(3), F(5), F(7), F(11) and so on are therefore pairwise coprime, and each is larger than 1. Each needs at least one prime factor of its own.
Suppose there were only r primes. Then there would be r − 1 odd primes to use as indices, and the corresponding Fibonacci numbers would have to share out the r primes with no overlap. That leaves room for only one of them to have two different prime factors. Yet two of them do: F(19) = 4181 = 37 × 113 and F(31) = 1346269 = 557 × 2417. The supply runs out, so the assumption was false. Compare this with Euclid's proof, which is shorter and needs no sequence at all.
Remainders go in circles
Reduce the sequence modulo 2 and you get 0, 1, 1, 0, 1, 1, repeating every 3 terms. Modulo 3 it reads 0, 1, 1, 2, 0, 2, 2, 1, repeating every 8.
A repeat is unavoidable. There are only finitely many pairs of consecutive remainders, and each pair determines everything after it and before it. So the sequence is periodic from the start, and the pair (0, 1) must come around again. The length of the cycle modulo m is called the Pisano period.
| modulus | Pisano period | first position divisible |
|---|---|---|
| 2 | 3 | 3 |
| 3 | 8 | 4 |
| 4 | 6 | 6 |
| 5 | 20 | 5 |
| 7 | 16 | 8 |
| 10 | 60 | 15 |
| 11 | 10 | 10 |
Because 0 recurs, every positive integer divides infinitely many Fibonacci numbers. The period of 60 modulo 10 says that last digits repeat every sixty terms.
The first position tells all
For a given number d, call the first position n ≥ 1 with F(n) divisible by d its entry point. The gcd identity shows that d divides F(k) exactly when the entry point divides k.
Here is the argument. If d divides both F(k) and F(n), it divides their greatest common divisor, which is F(gcd(k, n)). Since n was the first position, gcd(k, n) cannot be smaller than n, so n divides k. The other direction follows from F(n) dividing F(kn).
This turns divisibility questions about enormous terms into questions about small indices. Is F(1000) divisible by 7? The entry point of 7 is 8, and 1000 = 8 × 125, so it is. Is it divisible by 11? The entry point is 10, which also divides 1000, so yes. Since 7 and 11 are coprime, 77 divides F(1000), a number with more than two hundred digits.
Which primes divide which terms?
For a prime p other than 5, the first Fibonacci number divisible by p has a position that divides p − 1 or p + 1. Which one depends on p modulo 5.
- If p leaves remainder 1 or 4, then p divides F(p − 1). For p = 11, F(10) = 55.
- If p leaves remainder 2 or 3, then p divides F(p + 1). For p = 7, F(8) = 21, and for p = 13, F(14) = 377 = 13 × 29.
The prime 5 first divides F(5). The split by remainders modulo 5 is a consequence of whether 5 is a square modulo p, which quadratic reciprocity converts into a condition on p. The parallel with Fermat's little theorem is close.
A related puzzle is whether p² can divide the same term as p. Primes for which it does are called Wall–Sun–Sun primes. None had been found as of the mid-2020s, despite very large searches.
Primes in the sequence
Since F(m) divides F(n) when m divides n, a prime F(n) with n > 4 forces n to be prime. The exception at 4 occurs because F(2) = 1, and F(4) = 3.
The converse fails. The index 19 is prime, but F(19) = 4181 = 37 × 113. It is unknown whether infinitely many Fibonacci numbers are prime.
New prime factors, however, keep appearing. R. D. Carmichael proved that for every n greater than 12, F(n) has a prime factor that divides no earlier term. The value F(12) = 144 is the last exception, since its primes 2 and 3 have already appeared.
Squares and other special values
The only Fibonacci numbers that are perfect squares are 0, 1 and 144, proved by J. H. E. Cohn in the 1960s. Proving that the only cubes are 0, 1 and 8 was much harder and was done in the 2000s by Yann Bugeaud, Maurice Mignotte and Samir Siksek, using methods related to the proof of Fermat's Last Theorem.
Identities worth checking
- Cassini: F(n − 1) × F(n + 1) − F(n)² = (−1)^n. For n = 6: 5 × 13 − 64 = 1.
- Running sum: F(1) + F(2) + ... + F(n) = F(n + 2) − 1. For n = 6: 20 = 21 − 1.
- Sum of squares: F(1)² + ... + F(n)² = F(n) × F(n + 1). For n = 5: 1 + 1 + 4 + 9 + 25 = 40 = 5 × 8.
Zeckendorf's theorem adds that every positive integer is a sum of non-neighboring Fibonacci numbers in exactly one way, for instance 100 = 89 + 8 + 3.
A party trick with ten terms
Choose any two starting numbers and build ten terms by adding as usual. The sum of all ten is 11 times the seventh. With the ordinary sequence from F(1), the ten terms sum to 143, and the seventh is 13.
To see why, start with a and b. The terms are a, b, a + b, a + 2b, 2a + 3b, 3a + 5b, 5a + 8b, 8a + 13b, 13a + 21b and 21a + 34b. Adding gives 55a + 88b, which is 11 × (5a + 8b). The coefficients along the way are themselves Fibonacci numbers, a sign that the whole family of such sequences is governed by the original one.
So for any whole-number starting values, the total of ten consecutive terms is divisible by 11.
Computing large terms
Adding one term at a time is fine for hundreds of terms. To jump far ahead, use the doubling formulas:
F(2k) = F(k) · (2·F(k + 1) − F(k))
F(2k + 1) = F(k)² + F(k + 1)² With k = 5: F(10) = 5 × (16 − 5) = 55, and F(11) = 25 + 64 = 89. Combined with reducing modulo m at each step, this finds F(n) modulo m even when n is astronomically large, in the same spirit as finding last digits of huge powers.
The ratio of neighboring terms approaches a famous constant, discussed in the golden ratio, truth and myth. Appearances in plants are covered in sunflowers and pinecones.
A puzzle
Is F(30) divisible by 10? You need 2, which requires 3 to divide the index, and 5, which requires 5 to divide it. Both divide 30, so yes. In fact 30 is a multiple of 15, the first position divisible by 10, and F(30) = 832040.