WWikiTTheoremsFermat's little theorem
Theorem·T63
For a prime p, a to the p is congruent to a mod p, and a to the p minus 1 is congruent to 1 when p does not divide a.
In words
For a prime p, any a raised to the p is congruent to a modulo p; and if p does not divide a, a raised to p minus 1 is congruent to 1 modulo p.
Never needed: F10 · A03 · A04 · A05 · A07 · A09 (computed from the citation graph, not asserted).
Proof
- 1
- 2
- 3
- 4In both cases , and the coprime case additionally gives .
∎
Remarks
Fermat's little theorem (stated 1640). The form
holds for every
; the form
needs
. It is exactly Euler's theorem at a prime modulus, where
(L80). It underlies the Fermat primality test and much of public-key cryptography. Examples modulo
:
and
. The converse fails: the Carmichael number
satisfies
for every
yet is composite.