Theorem
Ifis prime then
Proof: Sinceand
we can concentrate on
Consider the set of
integers
If
then as
the congruence
has a unique solution
Let the solution be
so that
Now
for that would give
contradicting
Similarly
for that would imply
again contradicting
hence a' in S.
Finallyfor otherwise
which implies that
divides
so
divides either
or
by Euclid's Lemma which amount to
or
respectively, both of which contradict that
Hence for eachthere is
such that
so the elements of
form
distinct pairs
and
with
Multiplying these congruences together, each element of
appears exactly once so
Now multiply both sides byto give
and so
The converse of Wilson's theorem is also true: Ifthen n is prime.
Proof: Suppose thatdivides
Let
be a positive divisor of
then
so that
divides
But
divides
so
divides
so
has no divisors other than 1 and
so is prime.
To illustrate Wilson's Theorem, consider
We pair the numbers 2 to 15:
Henceand
Example: Find the smallest prime divisor of
By Wilson's theorem,divides
and no smaller prime does, because it would divide
hence 1.