On this page
Take the Fibonacci numbers 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 and keep only last digits: 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, and if you carry on long enough the pattern starts again from 0, 1. This happens for every modulus, and the length of the cycle has a name.
What is the Pisano period of Fibonacci numbers modulo n?
The Pisano period π(n) is the length of the cycle with which the Fibonacci numbers, taken modulo n, repeat (Wikipedia: Pisano period). It is named after Leonardo Pisano, better known as Fibonacci.
The Online Encyclopedia of Integer Sequences lists these numbers as sequence A001175 and defines π(n) as the least positive k with F(k) ≡ 0 and F(k + 1) ≡ 1 (mod n) (OEIS A001175): count steps until the pair (0, 1) comes back.
A classic early paper on the topic is D. D. Wall's "Fibonacci Series Modulo m" in The American Mathematical Monthly, 1960 (Crossref record). For more Fibonacci patterns, read our posts on Zeckendorf's theorem and Fibonacci sums and Fibonacci numbers hiding in Pascal's triangle.
Worked periods: π(2), π(3), π(5) and π(10)
Each value below is listed in the OEIS table of Pisano periods; we worked the residues by hand.
Mod 2: 0, 1, 1, then 0, 1 again. So π(2) = 3: even, odd, odd, forever.
Mod 3: 0, 1, 1, 2, 0, 2, 2, 1, then 0, 1. So π(3) = 8.
Mod 5: 0, 1, 1, 2, 3, 0, 3, 3, 1, 4, 0, 4, 4, 3, 2, 0, 2, 2, 4, 1, then 0, 1. So π(5) = 20. A 0 appears at every fifth step: every fifth Fibonacci number is a multiple of 5.
Mod 10: π(10) = 60, so the last digit of F(n) depends only on n mod 60.
The hero image lays out all 60 last digits as four rows of 15. Every row starts with 0, so F(0), F(15), F(30) and F(45) all end in 0, and the sixth column is always 5.
Why must Fibonacci numbers mod n repeat?
Each term is the sum of the two before it, so one pair of neighbours fixes the rest of the sequence. Modulo n, a pair (a, b) has at most n × n = n² possible values. So among the first n² + 1 pairs, two must be equal (the pigeonhole principle), and from then on everything repeats. OEIS notes that π(n) exists for every n "by Dirichlet's box principle" (OEIS A001175).
The cycle also returns to the very start. The rule runs backwards: from (b, a + b) you recover a as (a + b) − b. No pair has two different predecessors, so the repeat must reach (0, 1) itself. That is why every Pisano cycle begins 0, 1, 1.
Which primes give π(p) dividing p − 1, and which 2(p + 1)?
For primes other than 2 and 5 the rule is clean (Wikipedia: Pisano period):
If p ends in 1 or 9 (p ≡ ±1 mod 10), then π(p) divides p − 1.
If p ends in 3 or 7 (p ≡ ±3 mod 10), then π(p) divides 2(p + 1).
The reason is the equation x² = x + 1, whose roots drive Binet's formula. When p ≡ ±1 mod 10, quadratic reciprocity puts its roots among the ordinary remainders mod p, so their order, which is π(p), divides p − 1. Otherwise the roots live in a larger field, and the same article shows their order divides 2(p + 1).
Check it against the OEIS values:
p = 11: π(11) = 10, which divides 10.
p = 29: π(29) = 14, a proper divisor of 28.
p = 7: π(7) = 16, which equals 2(7 + 1).
p = 47: π(47) = 32, which divides 96 but is smaller.
The word is "divides", not "equals": examples 2 and 4 are easy to get wrong.
For composite n, the same article gives π(mn) = lcm(π(m), π(n)) when m and n are coprime. So π(10) = lcm(3, 20) = 60. Orders of elements are also the key to primitive roots modulo a prime.
How to find a Pisano period by hand
Start with the pair 0, 1.
Add the last two numbers and reduce mod n. Write only the remainder.
Stop when 0 is followed by 1. Count the terms before that point: that count is π(n).
Sanity-check: for n > 2, π(n) is even, according to Wikipedia. For a prime, check it divides p − 1 or 2(p + 1).
If modular arithmetic feels shaky, the Fermi Concept Library covers every concept in mathematics, each with its own lesson. To practise, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.



