Let p∈Z and a prime number and a∈Z such that gcd(a,p)=1 then ap−1≡1(modp). Furthermore for all a∈Z, we have ap≡a(modp)
Proof
We are calculating in Zp.
First let us show that 1⋅a,2⋅a,3⋅a,...,(p−1)⋅a are all different (modp).
Let r and s be such that r⋅a≡s⋅a(modp). Since gcd(a,p)=1, then r≡s(modp) by a preceding lemma.
Since they are all different, then 1⋅a,2⋅a,3⋅a,...,(p−1)⋅a is a permutation of non-zero elements of Zp
(1⋅a)(2⋅a)(3⋅a)...((p−1)⋅a)≡1⋅2⋅3⋅...⋅(p−1)
1⋅2⋅3⋅...⋅(p−1)⋅ap−1≡1⋅2⋅3⋅...⋅(p−1)
2<p and p is prime, so gcd(2,p)=1
3<p and p is prime, so gcd(3,p)=1
...
p−1<p and p is prime, so gcd(p−1,p)=1
It follows that:
ap−1=1(modp)
For the second statement we consider two cases:
- if gcd(a,p)=1
then we just show that
ap−1=1(modp)
ap=a(modp)
- if gcd(a,p)=1
then gcd(a,p)=p
therefore a≡0≡0p≡ap(modp)
Pseudo-primes
If p is an odd prime, then 2p−1≡1(modp)
If n is composite and bn−1≡1(modm) we say that n is pseudo-prime base b.