Вы находитесь на странице: 1из 4

A Note on the Carmichael Function

Yimin Ge

Abstract
The well known Euler’s Theorem states that xϕ(m) ≡ 1 (mod m) for
every positive integer m and every integer x coprime to m, where ϕ is
the Euler’s Totient Function.
However, with some exceptions, ϕ(m) is usually not the least positive
integer t so that xt ≡ 1 (mod m) holds for all integers x with gcd(x, m) =
1 and can be ”optimized” to the so-called Carmichael Function λ(m).
Properties of this function keep appearing in Olympiad problems and
can often be very useful. The purpose of this note is to state and prove
some of these properties and to give some examples of how they can be
applied in Olympiad problems.

Introduction

The following problem was given at the 3rd round of the 2006 Iranian
National Olympiad:
Problem 1. Let n be a positive integer and let d be the least positive
integer, so that ad ≡ 1 (mod n) holds for every integer a with gcd(a, n) =
1. Prove that there exists an integer b so that ordn (b) = d.
We will see that this problem is a special case of a more general result,
but before proving it, we shall cover some theory.
Definition 1. For a positive integer m and an integer x with gcd(x, m) =
1, the order of x modulo m, denoted by ordm (x), is the least positive
integer t, so that xt ≡ 1 (mod m).
Euler’s Theorem does not only imply that ordm (x) exists but implies
ordm (x) ≤ ϕ(m).
Lemma 1. Let m be a positive integer and x be an integer coprime to
m. Then xn ≡ 1 (mod m) if and only if ordm (x) | n. Furthermore,
xn1 ≡ xn2 (mod m) if and only if ordm (x) | (n1 − n2 ).
Proof. Let d = ordm (x). It is clear that d | n implies xn ≡ 1 (mod m).
On the other hand, if xn ≡ 1 (mod m), then there exist integers q, r
such that n = qd + r, 0 ≤ r ≤ d − 1, and

xn ≡ xqd+r ≡ xr ≡ 1 (mod m).

But 0 ≤ r ≤ d − 1, so r = 0.
Definition 2. Let m be a positive integer. An integer g is called a
primitive root modulo m if ordm (g) = ϕ(m).
Primitive roots however do not exist for every positive integer m.

Mathematical Reflections 2 (2007) 1


Lemma 2. Let m be a positive integer greater than 1. Then primitive
roots modulo m exist if and only if m has the form 2, 4, pk or 2pk where
p is an odd prime number and k is a positive integer.
This theorem is very well known, we skip the rather long proof of it
(interested readers can find a proof in [2]).

The Carmichael Function

Definition 3. For a positive integer m, λ(m) denotes the least positive


integer t so that xt ≡ 1 (mod m) for all integers x with gcd(x, m) = 1.
λ(m) is the so-called Carmichael Function.
Lemma 3. Let m be a positive integer. Then xt ≡ 1 (mod m) holds for
all integers x coprime to m if and only if λ(m) | t.
The proof of Lemma 3 is similar to the proof of Lemma 1 and is left
as an exercise to the reader.
Note that Euler’s Theorem implies λ(m) ≤ ϕ(m).
It is clear that if m has primitive roots, then λ(m) = ϕ(m). We will
now find a formula for λ(m).
Lemma 4. Let k ≥ 3 be an integer. Then λ(2k ) = 2k−2 .
Proof. We first observe that x2 ≡ 1 (mod 8) for all odd integers x.
k−2
Using induction, we can assume that x2 ≡ 1 (mod 2k ) for all odd
x and some k ≥ 3. Then either
k−2 k−2
x2 ≡1 (mod 2k+1 ) or x2 ≡ 1 + 2k (mod 2k+1 ).
k−1
We however have x2 ≡ 1 (mod 2k+1 ) in both cases, implying λ(2k ) ≤
2k−2 .
Now, let x be an odd integer so that ord16 (x) = 4 (i.e. any integer
congruent to 3 or 5 modulo 8). We clearly have ord8 (x) = 2.
Using induction, we can assume that ord2k (x) = 2k−2 and ord2k+1 (x) =
k−2 k−2
2k−1 for some k ≥ 3. Then x2 ≡ 1 (mod 2k ) but x2 6≡ 1 (mod 2k+1 ),
implying
k−2
x2 ≡ 1 + 2k (mod 2k+1 ).
Hence, either
k−2 k−2
x2 ≡ 1 + 2k (mod 2k+2 ) or x2 ≡ 1 + 2k + 2k+1 (mod 2k+2 ).
In both cases we have
k−1
x2 ≡ 1 + 2k+1 6≡ 1 (mod 2k+2 ).
Thus ord2k+2 (x) > 2k−1 . On the other hand, ord2k+2 (x) | ϕ(2k+2 ) =
2k+1 by Lemma 1, so ord2k+2 (x) ∈ {2k , 2k+1 }. But ord2k+2 (x) cannot
exceed λ(2k+2 ) and we already know that λ(2k+2 ) ≤ 2k . It follows that
ord2k+2 (x) = 2k and thus λ(2k+2 ) = 2k .

Mathematical Reflections 2 (2007) 2


The proof of Lemma 4 also shows that
Lemma 5. For any x congruent to 3 or 5 modulo 8, ord2k (x) = λ(2k ) =
2k−2 for all k ≥ 3.
Now, let a and b be two coprime positive integers and let d1 = λ(a),
d2 = λ(b) and d = λ(ab). Then xd ≡ 1 (mod ab) for any integer x
coprime to ab, so

xd ≡ 1 (mod a) and xd ≡ 1 (mod b) (1)

for all integers x coprime to ab. Now, from Lemma 3 it follows that d1 | d
and d2 | d is a necessary and sufficient condition for (1) and since d is the
least positive integer satisfying (1), it follows that d = lcm(d1 , d2 ). We
thus obtain
Lemma 6. For any coprime positive integers a and b, λ(ab) = lcm(λ(a), λ(b)).
We see that Lemma 2, 4 and 6 already give a complete formula for
λ(m). We summarize:
Theorem 1. Let m be a positive integer greater than 1. Then



ϕ(m) for m = 2, 4, pk , where p ≥ 3 is prime
k−2
2 for m = 2k , where k ≥ 3



r
λ(m) = Y .

lcm(λ(pk11 ), . . . , λ(pkr r )) for m = pki i , where pi are distinct


 i=1

 prime numbers.

We can now return to the beginning of this note and solve Problem
1.
Lemma 7. For any positive integer m, there exists an integer x so that
ordm (x) = λ(m).
Proof. Let m = pk11 · . . . · pkr r be the prime factorization of m and let x be
a solution of the congruence system

x ≡ gi (mod pki i ) for i = 1, . . . , r,

where gi are integers satisfying ordpki (x) = λ(pki i ) respectively (they ex-
i
ist by Lemma 2 and 5). Such an x exists by the Chinese Remainder
Theorem.
Then by Lemma 1, λ(pki i ) = ordpki (x) | ordm (x) for all i = 1, . . . , r.
i
Hence
ordm (x) ≥ lcm(λ(pk11 ), . . . , λ(pkr r )) = λ(m).
But ordm (x) cannot exceed λ(m), so ordm (x) = λ(m).
However, Lemma 7 can be generalized to

Mathematical Reflections 2 (2007) 3


Theorem 2. Let m and d be positive integers. Then there exists an
integer x with ordm (x) = d if and only if d | λ(m).
Proof. If ordm (x) = d for some x, then Lemma 1 implies d | λ(m).
On the other hand, if d | λ(m), let z be an integer with ordm (z) =
λ(m) (which exists by Lemma 7), e = λ(m)/d, and x = z e . Then
ordm (x) = d because
xd = z ed = z λ(m) ≡ 1 (mod m)
and ordm (x) < d would imply ordm (z) < ed = λ(m), a contradiction.
The application of the properties of the Carmichael Function are,
when possible, not always as obvious as it has been in Problem 1. The
following problem illustrates another kind of usage:
Problem 2. Prove that for any positive integer k, there is a positive
integer n so that 2k | 3n + 5.
Solution. We will only discuss k ≥ 3. The statement is true for k = 3,
just take n = 1 (we need this for the purpose of induction).
It follows from Lemma 5 that ord2k (3) = λ(2k ) = 2k−2 , so by Lemma
k−2
1, the numbers 31 , 32 , . . . , 32 all give different residues modulo 2k . How-
ever, since
ord2k+1 (3) = λ(2k+1 ) = 2k−1 > 2k−2 = ord2k (3),
from Lemma 1 it follows that
k−2 k−2
3i+2 ≡ 3i (mod 2k ) but 3i+2 6≡ 3i (mod 2k+1 )
and thus
k−2
3i+2 ≡ 3i + 2k (mod 2k+1 ).
Hence, if 3i ≡ −5 (mod 2k ), then either
k−2
3i ≡ −5 (mod 2k+1 ) or 3i+2 ≡ −5 (mod 2k+1 ).

References
[1] Mathlinks, Order,
http://www.mathlinks.ro/Forum/viewtopic.php?t=108204
[2] Mathlinks, Primitive root,
http://www.mathlinks.ro/Forum/viewtopic.php?t=55473
[3] Mathlinks, (2k ) | (3m + 5),
http://www.mathlinks.ro/Forum/viewtopic.php?t=1912

Yimin Ge: Vienna, Austria

Mathematical Reflections 2 (2007) 4

Вам также может понравиться