Wilson theorem

From Encyclopedia of Mathematics
Jump to: navigation, search

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.


[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.


[a1] D. Shanks, "Solved and unsolved problems in number theory" , Chelsea, reprint (1978)
[a2] M.R. Schroeder, "Number theory in science and communication" , Springer (1984) pp. 103
[a3] G.H. Hardy, E.M. Wright, "An introduction to the theory of numbers" , Clarendon Press (1960) pp. 68
[a4] Amrik Singh Nimbran, "Some Remarks on Wilson's Theorem", The Mathematics Student,Indian Mathematical Society, Vol. 67, Nos. 1–4 (1998), 243–245
How to Cite This Entry:
Wilson theorem. Encyclopedia of Mathematics. URL:
This article was adapted from an original article by N.I. Klimov (originator), which appeared in Encyclopedia of Mathematics - ISBN 1402006098. See original article