Learn/Number Theory/Wilson's Theorem
Number Theory • Topic 22

Wilson's Theorem

Wilson's Theorem gives a necessary and sufficient condition for primality based on factorials.

Statement

Theorem (Wilson's Theorem)
An integer is prime if and only if:

Proof Idea

  1. Composite : . Fail.
  2. Composite : Both and (where ) appear in . Or and . The product is .
  3. Prime : Every number has a unique inverse .
  • Group elements in pairs where .
  • Only elements that are their own inverses are .
  • The product is .

Applications

  • Used to prove properties of Quadratic Residues ().
  • Calculating remainders of huge factorials modulo .

Practice Problems

Exercise (Problem 1)
Find the remainder when is divided by 101.
Exercise (Problem 2)
Prove that if is prime, then .
Exercise (Problem 3)
If is an odd prime, prove that .