Wilson's Theorem
"A number above one is prime exactly when one less than it, factorialised, is one short of a multiple of it."
"A number above one is prime exactly when one less than it, factorialised, is one short of a multiple of it."
Wilson's theorem is a clean characterisation of the prime numbers using factorials. It states that a whole number greater than one is prime if and only if the factorial of one less than it, the product of all positive integers below it, is congruent to minus one modulo that number; equivalently, that factorial plus one is divisible by the number. The condition is both necessary and sufficient, so it perfectly separates primes from composites, unlike weaker tests that admit exceptions. For example, four factorial is twenty-four, and twenty-four plus one is twenty-five, a multiple of five, confirming five is prime. Elegant and exact, the theorem ties together factorials, divisibility, and primality in a single congruence.
(p-1)!+1 \equiv 0 \pmod pRated Empirical: grounded in studies or measurable evidence. The other 608.
The reason lies in how numbers pair up under multiplication modulo a prime. Among the numbers from one to one less than a prime, each has a unique partner whose product with it leaves remainder one, and only one and the number one less than the prime are their own partners. Pairing off all the others cancels their contributions to the factorial, leaving just the product of the two self-paired numbers, which works out to minus one modulo the prime. For a composite number greater than four, by contrast, its factors reappear inside the factorial and make it divisible by the number, giving remainder zero rather than minus one, so the congruence fails, which is exactly why the criterion detects composites.
The other half of the characterisation, that a composite number greater than four divides the factorial of one less than it, giving remainder zero and so failing the prime condition.
The small exception among composites, where three factorial is six, congruent to two modulo four rather than zero, the one composite that does not give remainder zero.
Wilson's theorem is prized as a rare exact characterisation of primality, a single congruence that is true for every prime and false for every composite, with no exceptions of the kind that plague probabilistic tests like the Fermat test and its Carmichael numbers. It is a jewel of elementary number theory, linking factorials to primes and illustrating the group structure of arithmetic modulo a prime. Though beautiful, it is impractical as an actual primality test, because computing the factorial of one less than a large number is far more work than modern tests require, so its value is theoretical and pedagogical rather than computational.
As a primality test the theorem is impractical, because evaluating the factorial of one less than a number requires more computation than the number of steps efficient modern tests need, so it is prized for elegance rather than use. It applies to whole numbers greater than one, and the small composite four is a special case giving remainder two rather than the zero that all larger composites give. The theorem characterises primality perfectly but offers no shortcut to factoring a composite it flags, so its exactness buys certainty about whether a number is prime without any help in decomposing it.
The theorem is an exact if-and-only-if characterisation, not a one-directional or probabilistic test, so unlike the Fermat test it has no false positives or Carmichael-number exceptions. Its perfection does not make it practical: the factorial involved is astronomically expensive, so it is not used to test large numbers despite being always correct. And the composite case gives remainder zero only for composites greater than four; the number four itself is the lone small exception, giving remainder two, which is a quirk to remember rather than a flaw.
Yes, as far as the evidence goes. Wilson's Theorem is rated Empirical here: it rests on studies or measurements rather than on a saying.
Rated from two sources. 609 of the 1,116 entries carry this rating. How the scale works.
The best-known laws are the least likely to rest on measurement.
Known to Ibn al-Haytham around the year one thousand, stated by John Wilson and reported by Edward Waring in his Meditationes Algebraicae of 1770, and first proved by Joseph-Louis Lagrange in 1771.
9 languages, as recorded on Wikidata. These are names the idea already goes by, not translations we made. The whole index by language.
Everything above traces to en.wikipedia.org and mathworld.wolfram.com: two secondary sources, accounts of the original rather than the original itself, which has not been located for this entry. Nothing is written from memory, and the method is written down. Spot an error or a better source? Suggest a fix.