Wilson's Theorem: Prime Criterion
- Wilson's Theorem is a fundamental result in number theory that defines prime numbers via the congruence (p-1)! ≡ -1 mod p.
- It is proven using group-theoretic and polynomial methods which clearly illustrate the special role of multiplicative inverses in modular arithmetic.
- Extensions include Wilson quotients and generalizations involving Stirling numbers, Bernoulli numbers, and factorial variants in finite fields.
Wilson’s theorem is the congruence
for prime , equivalently the primality criterion
for integers . It identifies primality through a factorial residue and has become a prototype for congruential primality criteria, -adic refinements, Stirling-number generalizations, and finite-field product formulas (Sauvaget, 2019). The congruence was discovered, in somewhat different language, by Lagrange in 1771, and later appeared under Wilson’s name (Hussein, 2018).
1. Classical formulation and arithmetic content
In its standard form, Wilson’s theorem asserts that if is prime, then , and the converse also holds: if , then is prime (Hussein, 2018). The theorem therefore gives an exact congruential characterization of primality.
A common sharpening separates the prime and composite cases more explicitly. For integers ,
0
with the unique composite exception 1, since 2 (Aebi et al., 2013). This formulation isolates the exceptional behavior of the modulus 3 and clarifies that the factorial is usually annihilated modulo a composite modulus.
The converse direction is elementary and structurally important. If 4 is composite and 5 is a nontrivial divisor of 6, then 7, so 8, hence 9 (Sauvaget, 2019). The prime case is therefore the genuinely nontrivial part of the theorem.
2. Proof architectures
The most classical proof uses the multiplicative group 0. Every residue 1 pairs with its inverse, and each pair contributes 2 to the total product. The only unpaired elements are those satisfying 3, namely 4 and 5, so
6
(Sauvaget, 2019). This proof makes explicit that the theorem is a statement about the involutive structure of the unit group.
A second proof is polynomial. Over 7, Fermat’s little theorem implies that every nonzero residue is a root of 8, hence
9
Comparing constant terms yields
0
(Levaillant, 2019). A closely related formulation is
1
which is the starting point for several later higher-power refinements (Kellner, 5 Sep 2025).
A third proof, closer to Lagrange’s original style, expands
2
where 3 is the 4th elementary symmetric sum in 5. A coefficient comparison after shifting the variable produces the recurrence
6
and when 7 is prime this recurrence yields 8. Setting 9 then gives 0 (Hussein, 2018). This approach is notable because the same symmetric-sum machinery also leads to Wolstenholme’s theorem.
3. Wilson quotient and higher prime powers
Wilson’s theorem can be reframed through the Wilson quotient
1
which is integral exactly because 2 (Kellner, 5 Sep 2025). This reformulation converts the basic congruence into a 3-adic object and opens the way to supercongruences.
A central auxiliary notion is the Fermat quotient
4
defined for 5, together with its power sums
6
Lerch’s congruence states that
7
(Kellner, 5 Sep 2025). Kellner’s later work lifts this to arbitrary higher prime powers by combining symmetric-function identities, Bell polynomials, and Newton’s identities. For every 8 and every odd prime 9, there are unique integer polynomials 0 with no constant term such that
1
and equivalently
2
An earlier higher-power milestone is Glaisher’s congruence, recovered by Levaillant through 3-adic lifting and Faulhaber polynomials: 4 The same method also yields a formula for 5 modulo 6 in terms of Bernoulli numbers (Levaillant, 2019).
Kellner’s second and third papers translate the 7-expansions into explicit congruences involving divided Bernoulli numbers and Kummer congruences, obtaining 8 modulo 9 and equivalently 0 modulo 1, then extending further to 2 modulo 3 and 4, and equivalently 5 modulo 6 and 7 (Kellner, 5 Sep 2025, Kellner, 30 Oct 2025).
| Paper | Explicit reach | Main mechanism |
|---|---|---|
| (Levaillant, 2019) | 8 mod 9, 0 | Hensel lifting, Faulhaber polynomials, Bernoulli numbers |
| (Kellner, 5 Sep 2025) | 1 mod 2, 3 mod 4 | 5-polynomials, Bernoulli polynomials, Kummer congruences |
| (Kellner, 30 Oct 2025) | 6 mod 7, 8; 9 mod 0, 1 | Fermat-quotient power sums, divided Bernoulli numbers |
These developments show that classical Wilson is the first layer of a much richer 2-adic expansion, rather than an isolated mod-3 coincidence.
4. Stirling-theoretic and combinatorial generalizations
A substantial generalization arises from Stirling numbers of the second kind. For positive integers 4 and complex 5, the Stirling function
6
satisfies
7
when 8, where
9
With 0, the main arithmetic result is: 1 (Williams, 2016). The case 2 gives
3
so classical Wilson is recovered exactly.
The same framework yields complementary congruences for Stirling numbers. If 4 is prime, then for every 5 and every 6,
7
(Williams, 2016). This places Wilson’s theorem inside a broader pattern of congruences indexed by Stirling shifts.
A distinct combinatorial extension replaces 8 by sums of products of subsets of 9. If 00 denotes the multiset of all products of 01-subsets of 02, then for fixed 03 and 04,
05
When 06, this reduces to Wilson’s theorem because 07 (Gaitanas, 2023).
Another extension interpolates among “partial factorial blocks.” For integers 08 and 09,
10
if and only if 11, and this leads to generalized Wilson quotients
12
(Morozov, 22 May 2025). This suggests a family of Wilson-type residues parameterized by the truncation point 13.
5. Wilson-like analogues beyond the ordinary factorial
Wilson-type congruences extend to several other factorial-like functions. For primes 14, Aebi and Cairns proved congruences for the superfactorial 15, the hyperfactorial 16, the double factorial 17, and the subfactorial 18 (Aebi et al., 2013). In particular, if 19 is prime, then
20
and for odd prime 21,
22
For all integers 23,
24
The prime-case congruences therefore organize several factorial variants around a small set of distinguished residues.
A particularly compact relation among these functions is
25
for primes 26 (Aebi et al., 2013). This gives a uniform residue-theoretic connection between ordinary Wilson behavior and higher factorial constructions.
There is also a finite-field analogue. For any odd prime power 27,
28
which is the direct finite-field version of Wilson’s theorem (Bluher, 2017). Bluher further defined natural subsets of 29 by quadratic-character conditions and obtained explicit products for these subsets. One example is
30
showing that Wilson-like product formulas persist after restricting from all nonzero field elements to Legendre-symbol slices (Bluher, 2017).
6. Relations to Giuga, Wolstenholme, and current themes
Wilson’s theorem also appears as one endpoint of an interpolation toward Giuga’s conjecture. Sauvaget introduced
31
with the properties
32
and
33
Thus 34 recovers Wilson’s criterion, while 35 gives the Giuga-type power-sum condition (Sauvaget, 2019). The interpolation conjecture proposed there is that for every fixed 36,
37
This suggests that Wilson’s theorem may be viewed as the first member of a broader family linking factorial and power-sum primality congruences.
The Lagrange symmetric-sum framework also connects Wilson with Wolstenholme’s theorem. Using the same elementary symmetric sums 38 that prove Wilson, one obtains
39
which is Wolstenholme’s theorem (Hussein, 2018). In this sense Wilson’s theorem is not isolated even among classical congruences: it belongs to a cluster of prime-specific identities accessible from the same algebraic setup.
Recent work therefore treats Wilson’s theorem less as a terminal statement than as a base layer. Stirling-function constructions, Bell-polynomial supercongruences, Bernoulli-number expansions, subset-product criteria, and finite-field character products all preserve the theorem’s central theme: primality manifests itself through exceptionally rigid multiplicative congruences (Williams, 2016, Kellner, 5 Sep 2025, Bluher, 2017).