MathLabs
TheoremProved

Fermat's little theorem

Statement

If pp is prime and aa is an integer not divisible by pp, then ap−1≡1(modp)a^{p-1}\equiv 1 \pmod{p}.

Why is it true?

Multiplying the numbers 1,2,…,p−11,2,\dots,p-1 by aa and reducing modulo pp just permutes them, since aa is invertible mod pp. So the product of the permuted list equals the product of the original list; cancelling the common factor (p−1)!(p-1)! leaves ap−1≡1a^{p-1}\equiv 1.

Proof sketch

The map k↦ak mod pk\mapsto ak\bmod p permutes {1,…,p−1}\{1,\dots,p-1\} because aa is invertible mod pp (as p∤ap\nmid a). Multiplying all residues gives ∏k=1p−1(ak)≡∏k=1p−1k(modp)\prod_{k=1}^{p-1}(ak) \equiv \prod_{k=1}^{p-1} k \pmod p, i.e. ap−1(p−1)!≡(p−1)!(modp)a^{p-1}(p-1)! \equiv (p-1)! \pmod p. Since gcd⁡((p−1)!,p)=1\gcd((p-1)!,p)=1, cancel to get ap−1≡1(modp)a^{p-1}\equiv 1\pmod p.

Stated by

Proved by

Topics that use this theorem

Related theorems

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Leonhard Euler (1736). Theorematum quorundam ad numeros primos spectantium demonstratio
  2. G. H. Hardy, E. M. Wright (2008). An Introduction to the Theory of Numbers · DOI:10.1093/oso/9780199219858.001.0001