Wilson's Theorem.

The theorem is named after John Wilson, who was a mathematician in Cambridge. He first stated it in 1770, as follows :-

A natural number n > 1 is a prime number, if and only if, (n-1)! ≡ -1 (mod n).

Aargh! How scary is that expression!

I discovered this formula in my spare time over the space of one year. Of course, I had never heard of it or Wilson and thought I had found the perfect formula to generate primes. After months of searching I found references to it in two old books on number theory, and realised I was 240 years too late.

I always state my version of the theorem as follows :-

If (n+1) is a factor of (n!+1) then (n+1) is a prime,


If the remainder when (n!+1)/(n+1) = 0, then (n+1) is a prime.

I feel that these expressions are easier to remember than Wilson's version (I also feel uneasy about negative remainders).

My Proof.

  1. If (n+1) is a factor of (n!+1) i.e. (n!+1) ≡ 0 mod (n+1), then (n+1) is the smallest factor of (n!+1).
  2. If there were a smaller factor then it must be in the set [2,3, ... ,n-1,n] and must also be a factor of (n!).
  3. No two consecutive +ve integers can have any common factor that is >1 (this is trivial to prove).
  4. The smallest factor (>1) of any positive integer is a prime number.