Papers
Topics
Authors
Recent
Search
2000 character limit reached

Wilson's Theorem: Prime Criterion

Updated 10 July 2026
  • 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

(p−1)!≡−1(modp)(p-1)!\equiv -1 \pmod p

for prime pp, equivalently the primality criterion

n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)

for integers n≥2n\ge2. It identifies primality through a factorial residue and has become a prototype for congruential primality criteria, pp-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 pp is prime, then (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p, and the converse also holds: if (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n, then nn 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 n≥2n\ge2,

pp0

with the unique composite exception pp1, since pp2 (Aebi et al., 2013). This formulation isolates the exceptional behavior of the modulus pp3 and clarifies that the factorial is usually annihilated modulo a composite modulus.

The converse direction is elementary and structurally important. If pp4 is composite and pp5 is a nontrivial divisor of pp6, then pp7, so pp8, hence pp9 (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 n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)0. Every residue n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)1 pairs with its inverse, and each pair contributes n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)2 to the total product. The only unpaired elements are those satisfying n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)3, namely n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)4 and n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)5, so

n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)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 n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)7, Fermat’s little theorem implies that every nonzero residue is a root of n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)8, hence

n∈P⟺n∣(1+(n−1)!)n\in\mathcal P \quad\Longleftrightarrow\quad n\mid \bigl(1+(n-1)!\bigr)9

Comparing constant terms yields

n≥2n\ge20

(Levaillant, 2019). A closely related formulation is

n≥2n\ge21

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

n≥2n\ge22

where n≥2n\ge23 is the n≥2n\ge24th elementary symmetric sum in n≥2n\ge25. A coefficient comparison after shifting the variable produces the recurrence

n≥2n\ge26

and when n≥2n\ge27 is prime this recurrence yields n≥2n\ge28. Setting n≥2n\ge29 then gives pp0 (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

pp1

which is integral exactly because pp2 (Kellner, 5 Sep 2025). This reformulation converts the basic congruence into a pp3-adic object and opens the way to supercongruences.

A central auxiliary notion is the Fermat quotient

pp4

defined for pp5, together with its power sums

pp6

Lerch’s congruence states that

pp7

(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 pp8 and every odd prime pp9, there are unique integer polynomials pp0 with no constant term such that

pp1

and equivalently

pp2

(Kellner, 5 Sep 2025).

An earlier higher-power milestone is Glaisher’s congruence, recovered by Levaillant through pp3-adic lifting and Faulhaber polynomials: pp4 The same method also yields a formula for pp5 modulo pp6 in terms of Bernoulli numbers (Levaillant, 2019).

Kellner’s second and third papers translate the pp7-expansions into explicit congruences involving divided Bernoulli numbers and Kummer congruences, obtaining pp8 modulo pp9 and equivalently (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p0 modulo (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p1, then extending further to (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p2 modulo (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p3 and (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p4, and equivalently (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p5 modulo (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p6 and (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p7 (Kellner, 5 Sep 2025, Kellner, 30 Oct 2025).

Paper Explicit reach Main mechanism
(Levaillant, 2019) (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p8 mod (p−1)!≡−1(modp)(p-1)!\equiv -1\pmod p9, (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n0 Hensel lifting, Faulhaber polynomials, Bernoulli numbers
(Kellner, 5 Sep 2025) (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n1 mod (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n2, (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n3 mod (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n4 (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n5-polynomials, Bernoulli polynomials, Kummer congruences
(Kellner, 30 Oct 2025) (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n6 mod (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n7, (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n8; (n−1)!≡−1(modn)(n-1)!\equiv -1\pmod n9 mod nn0, nn1 Fermat-quotient power sums, divided Bernoulli numbers

These developments show that classical Wilson is the first layer of a much richer nn2-adic expansion, rather than an isolated mod-nn3 coincidence.

4. Stirling-theoretic and combinatorial generalizations

A substantial generalization arises from Stirling numbers of the second kind. For positive integers nn4 and complex nn5, the Stirling function

nn6

satisfies

nn7

when nn8, where

nn9

With n≥2n\ge20, the main arithmetic result is: n≥2n\ge21 (Williams, 2016). The case n≥2n\ge22 gives

n≥2n\ge23

so classical Wilson is recovered exactly.

The same framework yields complementary congruences for Stirling numbers. If n≥2n\ge24 is prime, then for every n≥2n\ge25 and every n≥2n\ge26,

n≥2n\ge27

(Williams, 2016). This places Wilson’s theorem inside a broader pattern of congruences indexed by Stirling shifts.

A distinct combinatorial extension replaces n≥2n\ge28 by sums of products of subsets of n≥2n\ge29. If pp00 denotes the multiset of all products of pp01-subsets of pp02, then for fixed pp03 and pp04,

pp05

When pp06, this reduces to Wilson’s theorem because pp07 (Gaitanas, 2023).

Another extension interpolates among “partial factorial blocks.” For integers pp08 and pp09,

pp10

if and only if pp11, and this leads to generalized Wilson quotients

pp12

(Morozov, 22 May 2025). This suggests a family of Wilson-type residues parameterized by the truncation point pp13.

5. Wilson-like analogues beyond the ordinary factorial

Wilson-type congruences extend to several other factorial-like functions. For primes pp14, Aebi and Cairns proved congruences for the superfactorial pp15, the hyperfactorial pp16, the double factorial pp17, and the subfactorial pp18 (Aebi et al., 2013). In particular, if pp19 is prime, then

pp20

and for odd prime pp21,

pp22

For all integers pp23,

pp24

The prime-case congruences therefore organize several factorial variants around a small set of distinguished residues.

A particularly compact relation among these functions is

pp25

for primes pp26 (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 pp27,

pp28

which is the direct finite-field version of Wilson’s theorem (Bluher, 2017). Bluher further defined natural subsets of pp29 by quadratic-character conditions and obtained explicit products for these subsets. One example is

pp30

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

pp31

with the properties

pp32

and

pp33

Thus pp34 recovers Wilson’s criterion, while pp35 gives the Giuga-type power-sum condition (Sauvaget, 2019). The interpolation conjecture proposed there is that for every fixed pp36,

pp37

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 pp38 that prove Wilson, one obtains

pp39

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

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Wilson's Theorem.