Wilson's Theorem/Sufficient Condition
Theorem
Let $p$ be a (strictly) positive integer such that:
- $\paren {p - 1}! \equiv -1 \pmod p$
Then $p$ is a prime number.
Proof
Assume $p$ is composite, and $q$ is a prime such that $q \divides p$.
Then both $p$ and $\paren {p - 1}!$ are divisible by $q$.
If the congruence $\paren {p - 1}! \equiv -1 \pmod p$ were satisfied, we would have $\paren {p - 1}! \equiv -1 \pmod q$.
However, this amounts to $0 \equiv -1 \pmod q$, a contradiction.
Hence for $p$ composite, the congruence $\paren {p - 1}! \equiv -1 \pmod p$ cannot hold.
$\blacksquare$
Also known as
Some sources refer to Wilson's Theorem as the Wilson-Lagrange theorem, after Joseph Louis Lagrange, who proved it.
Source of Name
This entry was named for John Wilson.
Historical Note
The proof of Wilson's Theorem was attributed to John Wilson by Edward Waring in his $1770$ edition of Meditationes Algebraicae.
It was first stated by Ibn al-Haytham ("Alhazen").
It appears also to have been known to Gottfried Leibniz in $1682$ or $1683$ (accounts differ).
It was in fact finally proved by Lagrange in $1793$.