Wilson Fermat Ejercicio
Wilson Fermat Ejercicio
Wilson Fermat Ejercicio
Lemma. Let p be a prime and let 0 < k < p. k2 = 1 (mod p) if and only if k = 1 or k = p 1.
Proof. If k = 1, then k2 = 1 (mod p). If k = p 1, then
k2 = p2 2p + 1 = 1 (mod p) .
Conversely, suppose k2 = 1 (mod p). Then
p | k2 1 = (k 1)(k + 1),
and since p is prime, p | k 1 or p | k + 1. The only number in {1, . . . , p 1} which satisfies p | k 1 is 1,
and the only number in {1, . . . , p 1} which satisfies p | k + 1 is p 1.
Theorem. (Wilsons theorem) Let p > 1. p is prime if and only if
(p 1)! = 1 (mod p) .
Proof. Suppose p is prime. If k {1, . . . , p 1}, then k is relatively prime to p. So there are integers a and
b such that
ak + bp = 1, or ak = 1 (mod p) .
Reducing a mod p, I may assume a {1, . . . , p 1}.
Thus, every element of {1, . . . , p 1} has a reciprocal mod p in this set. The preceding lemma shows
that only 1 and p 1 are their own reciprocals. Thus, the elements 2, . . . , p 2 must pair up into pairs
{x, x1 }. It follows that their product is 1. Hence,
(p 1)! = 1 2 (p 2) (p 1) = 1 1 (p 1) = p 1 = 1 (mod p) .
Now suppose (p 1)! = 1 (mod p). I want to show p is prime. Begin by rewriting the equation as
(p 1)! + 1 = kp.
Suppose p = ab. I may take 1 a, b p. If a = p, the factorization is trivial, so suppose a < p. Then
a | (p 1)! (since its one of {1, . . . , p 1}) and a | p, so (p 1)! + 1 = kp shows a | 1. Therefore, a = 1.
This proves that the only factorization of p is the trivial one, so p is prime.
Example. Wilsons theorem implies that the product of any ten consecutive numbers, none divisible by 11,
equals 1 mod 11 (since any ten consecutive numbers reduce mod 11 to {1, 2, . . . , 10}. For example,
12 13 20 21 = 1 (mod 11) .
and
Ill the the iterative method of the Chinese Remainder Theorem to get a congruence mod 5183. First,
70! = 1 (mod 71) means 70! = 1 + 71a for some a Z. Plugging this into the second congruence yields
1 + 71a = 36 (mod 73) ,
71a = 37 (mod 73) ,
2a = 37 (mod 73) ,
(37)(2a) = (37)(37) (mod 73) ,
a = 1369 = 18 (mod 73) .
The last congruence means that a = 18 + 73b for some b Z. Plugging this into 70! = 1 + 71a gives
70! = 1 + 71(18 + 73b) = 1277 + 5183b,
Theorem. (Fermat) Let p be prime, and suppose p 6 | a. Then ap1 = 1 (mod p).
Proof. The idea is to show that the integers
a, 2a, . . . , (p 1)a
reduce mod p to the standard system of residues {1, . . . , p 1}, then apply Wilsons theorem.
There are p 1 numbers in the set {a, 2a, . . . , (p 1)a}. So all I need to do is show that theyre distinct
mod p. Suppose that 1 j, k p 1, and
aj = ak (mod p) .
This means p | aj ak = a(j k), so p | a or p | j k. Since the first case is ruled out by assumption,
p | j k. But since 1 j, k p 1, this is only possible if j = k.
Thus, {a, 2a, . . . , (p 1)a} are p 1 distinct numbers mod p. So if I reduce mod p, I must get the
numbers in {1, . . . , p 1}. Hence,
a 2a (p 1)a = 1 2 (p 1) = (p 1)! = 1 (mod p) .
2
Now this is an answer, but a rather cheesy one. I ought to reduce the right side mod 41 to something
a little smaller! I cant use Fermat any more, so I just divide and conquer.
162 = 256 = 10 (mod 41), so
1639 25 = (162 )19 (16 25) = 1019 400 = 1019 31 (mod 41) .
Now 102 = 100 = 18 (mod 41), so
1019 31 = (102 )9 (10 31) = 189 310 = 189 23 (mod 41) .
182 = 324 = 37 (mod 41), so
189 23 = (182 )4 (18 23) = 374 414 = 1874161 414 = 10 4 = 40 (mod 41) .
(I reduce down to the point where the arithmetic can be handled by whatever computational tools I
have available.)