Wilson quotient

The Wilson quotient W(p) is defined as:


 * $$W(p) = \frac{(p-1)! + 1}{p}$$

If p is a prime number, the quotient is an integer by Wilson's theorem; moreover, if p is composite, the quotient is not an integer. If p divides W(p), it is called a Wilson prime. The integer values of W(p) are :


 * W(2) =&thinsp;1
 * W(3) =&thinsp;1
 * W(5) = 5
 * W(7) =&thinsp;103
 * W(11) = 329891
 * W(13) = 36846277
 * W(17) =&thinsp;1230752346353
 * W(19) = 336967037143579

It is known that


 * $$W(p)\equiv B_{2(p-1)}-B_{p-1}\pmod{p},$$
 * $$p-1+ptW(p)\equiv pB_{t(p-1)}\pmod{p^2},$$

where $$B_k$$ is the k-th Bernoulli number. Note that the first relation comes from the second one by subtraction, after substituting $$t=1$$ and $$t=2$$.