Exercise 1282Number theory › PrimesOlympiadAdded 4 Nov 2026
Wilson's theorem and its converse
#Wilson's theorem#modular inverses#primality
Statement
- Prove that for a prime , .
- Prove that an integer is prime if and only if .
Hint
In pair each number with its inverse modulo . Which numbers are their own inverse?
Show solutionHide solution
Solution
1. For the claim is checked directly (, ). Let . Each has a unique inverse in modulo . We have iff iff iff , i.e. .
Hence the numbers split into pairs with product , so , and
2. () is part 1. () Suppose is composite, with a divisor such that . Then , so , and therefore . Hence forces prime.
Remark. Wilson's criterion is a perfect primality test in theory, but useless in practice because is huge.
Lesson. In a group of residues, pair every element with its inverse: only the elements with survive.