The Period of The Fibonacci Sequence Modulo J
The Period of The Fibonacci Sequence Modulo J
The Period of The Fibonacci Sequence Modulo J
Charles W. Campbell II
Math 399 Spring 2007
Advisor: Dr. Nick Rogers
Introduction
The main objectives of this project were to examine the Fibonacci sequence mod-
ulo j, a positive integer, with the intentions of generalizing the results to general se-
quences defined by linear recursions and to utilize information being acquired during
the semester. The main part of the research involved investigating the periodicity of
the new sequence obtained after modding out by j. We begin by establishing a moti-
vation for investigating the sequence modulo p a prime and pk a prime power by first
investigating the Fibonacci sequence modulo j, a positive integer. Next we investigate
the Fibonacci sequence modulo p a prime and then generalize to prime powers. True
to the objective the results we obtained were through the use of (but not limited to)
important ideas from both Number Theory and Abstract Algebra including Fermat’s
Little Theorem , Euler’s generalization of Fermat’s Little Theorem, Quadratic Reci-
procity, and Field Theory. Lastly we apply the results established for the Fibonacci
sequence to easily prove results for the Lucas sequence modulo p a prime.
In the study of the Fibonacci sequence, it will be nice to be able to calculate the
Fibonacci numbers themselves. There is a closed form equation for doing just that, but
before we prove that this equation gives us the correct members of the sequence, we √
1+ 5
introduce the
√
following identities which help us in the proof. Throughout let φ = 2
1− 5
and φ̄ = 2 .
Identity 1.
√ !2 √ √ √ √
1+ 5 1+2 5+5 6+2 5 3+ 5 2+1+ 5
φ2 = = = = = = 1 + φ. (2)
2 4 4 2 2
Identity 2.
√ !2 √ √ √ √
1− 5 1−2 5+5 6−2 5 3− 5 2+1− 5
φ̄2 = = = = = = 1 + φ̄. (3)
2 4 4 2 2
We are now prepared to state and prove the first and most widely used result, the
closed form for generating the Fibonacci numbers.
Theorem 1. Fn = √1 (φ n − φ̄ n ).
5
Now assume that P(n) is true up to some n ∈ N, n > 1, and consider P(n + 1).
1 n−1 n−1 1 n
Fn+1 = Fn−1 + Fn = √ (φ − φ̄ ) + √ (φ − φ̄ n )
5 5
1 n−1
= √ ((φ − φ n ) − (φ̄ n−1
− φ̄ n ))
5
1 n−1 n−1
= √ (φ (1 + φ) − φ̄ (1 + φ̄))
5
1 n−1 1
= √ (φ (φ 2 ) − φ̄ n−1
(φ̄ 2 )) = √ (φ n+1
− φ̄ n+1
).
5 5
Therefore P(n + 1) is true, so by induction, we conclude that P(n) is true ∀ n ∈ N.
Upon investigating the Fibonacci sequence modulo an integer j, it becomes evi-
dent that this modified sequence is periodic in nature. It should be noted that due to
the nature of the recurrence relation defining Fn , from any point in the sequence, the
future sequence is completely determined by two consecutive terms. Thus, consider-
ing two arbitrary consecutive members of the sequence modulo j, i.e the ordered pairs
(Fn (mod j), Fn+1 (mod j)), we see that there are j choices for each Fn and Fn+1 so that
there are j 2 possibilities for these consecutive numbers. Since there are a finite number
of possibilities for these consecutive elements, our sequence must be eventually periodic,
i.e. that it comes back to some member of the sequence and repeats thereafter. Again,
due to the nature of the recurrence relation, we find that it is reversible, i.e. that we
can go backwards in the sequence. Therefore we must come back to the beginning of
the sequence, and thus we find that Fn (mod j) must be purely periodic. Now that we
know it exists, we are ready to define exactly what is meant by the period modulo j.
Definition The period of the Fibonacci sequence modulo a positive integer j is the
smallest positive integer m such that Fm ≡ 0 (mod j) and Fm+1 ≡ 1 (mod j).
Note that since Fn (mod j) is purely periodic, if m is the period of Fn (mod j), then
every m-th member of the sequence modulo j must come back to the starting point.
By the definition above, the only members that can possibly come back to the starting
point are multiples of m. This can be summed up in the statement that if m is the
period of Fn (mod j), then for any k ∈ Z
(
Fk ≡ 0 (mod j)
⇔ m | k. (4)
Fk+1 ≡ 1 (mod j)
The statement above and the corollary of the following theorem will be crucial in
proving almost every theorem regarding the period modulo j.
p p
pn+1 pn p n+1 p p n+1
X p n+1 i n+2
X p
a = (a ) = (1+sp ) = 1+ sp + (sp ) = 1+sp + (spn+1 )i
1 i=2
i i=2
i
Proof. Since
φm − φ̄m
Fm ≡ √ ≡ 0 (mod p)
5
we have
φm ≡ φ̄m (mod p).
k−1 k−1
(φm )p ≡ (φ̄m )p ≡ 1 (mod pk ).
We first investigate the period modulo a positive integer j in order to show that it
is dependent on the period modulo the prime powers that divide j.
s
Y
Theorem 3. Let j be a positive integer with j = pi ki , for pi a prime, and let mi
i=1
denote the period of Fn (mod pi ki ). If m is the period of Fn (mod j), then
m = lcm(m1 , m2 , ..., ms ).
s
Y
Proof. Let j = pi ki be a positive integer, let m be the period of Fn (mod j), and let
i=1
mi be the period of Fn (mod pi ki ). So
(
Fm ≡ 0 (mod j)
Fm+1 ≡ 1 (mod j).
and s
Y
Fm0 ≡ 0 (mod p i ki )
i=1
s
Y ∀i.
p i ki )
F 0
m +1
≡ 1 (mod
i=1
But this is not the period because lcm(m1 , m2 , ..., ms ) = m∗ | m0 , and by (4) we have
that s
Y
F ≡ 0 (mod p i ki )
∗
m
i=1
Ys ∀i.
k
Fm∗ +1 ≡ 1 (mod pi ) i
i=1
∗
Therefore since m is the least positive integer satisfying the above, by definition
m = m∗ = lcm(m1 , m2 , ..., ms ).
Because the period modulo j depends on the prime powers dividing j, we are mo-
tivated to investigate the period modulo a prime power. To facilitate this, we need
to look at the period modulo a prime p. In order to do this we must first determine
the conditions under which we can apply Fermat’s Little Theorem to φ, and φ̄. The
following theorem determines the primes for which φ and φ̄ are elements of the field
Z/pZ which we denote Fp .
1
=1 ⇔ p ≡ 1 (mod 5)
5
2
5−1
≡ 2 2 ≡ −1 (mod 5) ⇔ p ≡ 2 (mod 5)
5
p
=
5
3
5−1
≡ 3 2 ≡ −1 (mod 5) ⇔ p ≡ 3 (mod 5)
5
2
4 2
= =1 ⇔ p ≡ 4 (mod 5)
5 5
Therefore 5 is a quadratic residue modulo p if and only if p ≡ ±1 (mod 5), and 5 is a
quadratic nonresidue modulo p if and only if p ≡ ±2 (mod 5).
By the above we conclude that for p ≡ ±1 (mod 5), φ and φ̄ are elements of Fp
and for p ≡ ±2 (mod 5), φ and φ̄ are not elements of Fp . In this second case we need
to find an appropriate extension field of Fp that contains both φ and φ̄. The following
theorems contain results regarding the period modulo p, a prime,
Theorem 5. Let p be a prime and m be the period of Fn (mod p). If p ≡ ±1 (mod 5),
then m | p − 1.
Proof. Let p be a prime, let m be the period of Fn modulo p, and suppose that
p ≡ ±1 mod 5. Theorem 4 tells us that 5 is a quadratic residue for this choice of p,
so we conclude that φ, φ̄ are elements of Fp . Applying Fermat’s Little Theorem, we have
√ √ ! √
1 1+ 5−1+ 5 1 2 5
≡√ ≡√ (mod p)
5 2 5 2
≡ 1 (mod p).
√ !p √ !p p √ !p
1+ 5 1 5 1 5
φp = = + = +
2 2 2 2 2
p
1 √ p 1 p−1 √
= 1+ 5 = 1+5 2 5
2 2
√
1 √ 1− 5
= 1− 5 =
2 2
= φ̄.
Similarly
√ !p √ !p p √ !p
1− 5 1 5 1 5
φ̄p = = − = −
2 2 2 2 2
p
1 √ p 1 p−1 √
= 1− 5 = 1−5 2 5
2 2
√
1 √ 1+ 5
= 1+ 5 =
2 2
= φ.
Therefore it is easily seen that
φp − φ̄p φ̄ − φ
Fp ≡ √ ≡ √ ≡ (p − 1) (mod p),
5 5
φp+1 − φ̄p+1 φp φ − φ̄p φ̄ φ̄φ − φφ̄
Fp+1 ≡ √ ≡ √ ≡ √ ≡ 0 (mod p),
5 5 5
and
Therefore, for our choice of p, we see that m does not divide p + 1. It is seen that
2
φ2p+1 − φ̄2p+1 (φp )2 φ − φ̄p φ̄
F2p+1 ≡ √ ≡ √ (mod p)
5 5
φ̄2 φ − φ2 φ̄
φ̄ − φ
≡ √ ≡ φφ̄ √ (mod p)
5 5
≡ 1 mod p,
2
φ2p+2 − φ̄2p+2 (φp )2 φ2 − φ̄p φ̄2 φ̄2 φ2 − φ2 φ̄2
F2p+2 ≡ √ ≡ √ ≡ √ ≡ 0 (mod p),
5 5 5
and
Therefore, since (
F2p+2 ≡ 0 (mod p)
F2p+3 ≡ 1 (mod p),
2p+2
by (4) we have that m 2p + 2, and since m does not divide p + 1, m
must be odd.
Now that we have results regarding the period of Fn (mod p) we are ready to inves-
tigate the period modulo a prime power, i.e. the period of Fn (mod pk ).
Theorem 7. Let p be a prime, let m denote the period of Fn modulo p, and let m0
denote the period of Fn modulo pk . Then m0 | mpk−1 .
Proof. By Corollary 1 we know that
k−1 k−1
φmp ≡ φ̄mp ≡ 1 (mod pk ).
In every known case of the above theorem m0 = mpk−1 , but there are thought to be
infinitely many primes for which this is not true. Since we now have results regarding
the period of Fn (mod pk ) we can apply Theorem 3 to tell us about the period modulo
the product of prime powers. Therefore given a positive integer j we can determine the
possibilities for the period of Fn (mod j). That is, given j a positive integer and m
the period modulo j, we can apply Theorems 3, 5, 6, and 7 to tell us that m divides a
certain number t, but we can’t be certain if t equals m or not.
We now turn our attention to another sequence defined by a recursion relation that
is closely related to the Fibonacci sequence, the Lucas sequence.
Like the Fibonacci numbers, there is a closed form equation that makes calculating
the Lucas numbers easier.
Theorem 8. Ln = φn + φ̄n
Proof. Using induction, let P(n) be the statement Ln = φn + φ̄n . P(0) is true since
L0 = φ0 + φ̄0 = 1 + 1 = 2
and P(1) is true as
√ √
1+ 5+1− 5 2
L1 = φ + φ̄ = = = 1.
2 2
Now assume that P(n) is true for some n ∈ N and consider P(n + 1).
= φn−1 (1 + φ) + φ̄n−1 1 + φ̄
= Ln−1 + Ln
Like the Fibonacci sequence, when we investigate the Lucas sequence modulo j an
integer, we find that the new sequence is purely periodic and for the same reasons as
Fibonacci sequence.
Definition The period of the Lucas sequence modulo a positive integer j is the smallest
positive integer l such that Ll ≡ 2 (mod j) and Ll+1 ≡ 1 (mod j).
Again, for the same reasons as the Fibonacci sequence we have that if l is the period
of Ln (mod j) then (
Lk ≡ 2 (mod j)
⇔l|k (5)
Lk+1 ≡ 1 (mod j)
Theorem 9. For p be a prime, let l be the period of Ln (mod p). If p ≡ ±1(mod 5),
then l | p − 1.
Proof. Let p be a prime, let l be the period of Ln mod p and suppose that
p ≡ ±1 (mod 5). Since p ≡ ±1 (mod 5) we know that φ, φ̄ ∈ Fp and thus
Theorem 10. For p be a prime, let l be the period of Ln (mod p). If p ≡ ±2 (mod 5),
then l | 2p + 2.
Proof. Let p be a prime, let l be the period of Ln (mod p) and suppose that
p ≡ ±2 (mod 5). Since p ≡ ±2 (mod 5) we know that φp ≡ φ̄ (mod p) and
φ̄p ≡ φ (mod p). Thus we have
≡ 2 (mod p)
and
≡ 1 (modp).
Therefore by (5) we have that l 2p + 2.
References
[1] Gallian, Joe A. Contemporary Abstract Algebra. Sixth Edition. Houghton
Mifflin. 2006.