Difference between revisions of "Wilson theorem"

Let $p$ be a prime number. Then the number $(p-1)!+1$ is divisible by $p$. The theorem was first formulated by E. Waring (1770) and is, according to him, due to J. Wilson. It was proved by J.L. Lagrange in 1771. A primality test for integers follows from Wilson's theorem: A natural number $n>1$ will be prime if and only if $$(n-1)! + 1 \equiv 0 \pmod n$$

This test is not recommended for practical use, since the factorial involved rapidly becomes very large.

References

 [1] A.A. Bukhshtab, "Number theory" , Moscow (1966) (In Russian) Zbl 0144.27402 [2] E. Trost, "Primzahlen" , Birkhäuser (1953) Zbl 0053.36002 [3] I.M. [I.M. Vinogradov] Winogradow, "Elemente der Zahlentheorie" , R. Oldenbourg (1956) (In German: translated from Russian) Zbl 0070.03802

In fact, also the converse is true (and usually also called Wilson's theorem): Let $N = (p-1)!+1$, with $p \in \mathbf{N}$. Then $N$ is divisible by $p$ if and only if $p$ is a prime number.