# Wilson prime

Named after John Wilson 1938[1] Emma Lehmer 3 5, 13, 563 563 A007540Wilson primes: primes p such that (p-1)! == -1 (mod p^2)

A Wilson prime, named after English mathematician John Wilson, is a prime number p such that p2 divides (p − 1)! + 1, where "!" denotes the factorial function; compare this with Wilson's theorem, which states that every prime p divides (p − 1)! + 1.

The only known Wilson primes are 5, 13, and 563 (sequence A007540 in the OEIS); if any others exist, they must be greater than 2×1013.[2] It has been conjectured that infinitely many Wilson primes exist, and that the number of Wilson primes in an interval [xy] is about log(log(y)/log(x)).[3]

Several computer searches have been done in the hope of finding new Wilson primes.[4][5][6] The Ibercivis distributed computing project includes a search for Wilson primes.[7] Another search was coordinated at the Great Internet Mersenne Prime Search forum.[8]

## Generalizations

### Wilson primes of order n

Wilson's theorem can be expressed in general as ${\displaystyle (n-1)!(p-n)!\equiv (-1)^{n}\ {\bmod {p}}}$ for every integer ${\displaystyle n\geq 1}$ and prime ${\displaystyle p\geq n}$. Generalized Wilson primes of order n are the primes p such that ${\displaystyle p^{2}}$ divides ${\displaystyle (n-1)!(p-n)!-(-1)^{n}}$.

It was conjectured that for every natural number n, there are infinitely many Wilson primes of order n.

${\displaystyle n}$ prime ${\displaystyle p}$ such that ${\displaystyle p^{2}}$ divides ${\displaystyle (n-1)!(p-n)!-(-1)^{n}}$ (checked up to 10000) OEIS sequence
1 5, 13, 563, ... A007540
2 2, 3, 11, 107, 4931, ... A079853
3 7, ...
4 10429, ...
5 5, 7, 47, ...
6 11, ...
7 17, ...
8 ...
9 541, ...
10 11, 1109, ...
11 17, 2713, ...
12 ...
13 13, ...
14 ...
15 349, ...
16 31, ...
17 61, 251, 479, ... A152413
18 13151527, ...
19 71, ...
20 59, 499, ...
21 217369, ...
22 ...
23 ...
24 47, 3163, ...
25 ...
26 97579, ...
27 53, ...
28 347, ...
29 ...
30 137, 1109, 5179, ...

Least generalized Wilson prime of order n are

5, 2, 7, 10429, 5, 11, 17, ... (The next term > 1.4×107) (sequence A128666 in the OEIS)

### Near-Wilson primes

A prime p satisfying the congruence (p − 1)! ≡ − 1 + Bp mod p2 with small |B| can be called a near-Wilson prime. Near-Wilson primes with B = 0 represent Wilson primes. The following table lists all such primes with |B| ≤ 100 from 106 up to 4×1011:[2]

### Wilson numbers

A Wilson number is a natural number n such that W(n) ≡ 0 (mod n2), where ${\displaystyle W(n)=\prod _{\stackrel {1\leq k\leq n}{\gcd(k,n)=1}}{k}+e}$, the constant e = 1 if and only if n have a primitive root, otherwise, e = -1[9] For every natural number n, W(n) is divisible by n, and the quotients (called generalized Wilson quotients) are listed in . The Wilson numbers are

1, 5, 13, 563, 5971, 558771, 1964215, 8121909, 12326713, 23025711, 26921605, 341569806, 399292158, ... (sequence A157250 in the OEIS)

If a Wilson number n is prime, then n is a Wilson prime. There are 13 Wilson numbers up to 5×108.[10]

## Notes

1. ^ Lehmer, Emma (April 1938). "On congruences involving Bernoulli numbers and the quotients of Fermat and Wilson" (PDF). Annals of Mathematics. 39 (2): 350–360. doi:10.2307/1968791. JSTOR 1968791. Retrieved 8 March 2011.
2. ^ a b A Search for Wilson primes Retrieved on November 2, 2012.
3. ^ The Prime Glossary: Wilson prime
4. ^ McIntosh, R. (9 March 2004). "WILSON STATUS (Feb. 1999)". E-Mail to Paul Zimmermann. Retrieved 6 June 2011.
5. ^ A search for Wieferich and Wilson primes, p 443
6. ^ Ribenboim, P.; Keller, W. (2006). Die Welt der Primzahlen: Geheimnisse und Rekorde (in German). Berlin Heidelberg New York: Springer. p. 241. ISBN 978-3-540-34283-0.
7. ^ Ibercivis site
8. ^ Distributed search for Wilson primes (at mersenneforum.org)
9. ^
10. ^ Agoh, Takashi; Dilcher, Karl; Skula, Ladislav (1998). "Wilson quotients for composite moduli" (PDF). Math. Comput. 67 (222): 843–861. doi:10.1090/S0025-5718-98-00951-X.