Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm confused by the idea of a Wilson Prime. The theorem states that $$p^2=(p-1)!+1$$

This makes sense for $5$: $$5^2=(4\times3\times2)+1$$ so $5^2=25$

But it makes no sense to me for $13$: $$13^2=4790016001$$ Clearly I am as far from a mathematician as possible. If you can help in very simple terms...

share|cite|improve this question
Which theorem states that $p^2=(p-1)!+1$? Wilson's theorem states that $p$ divides $(p-1)!+1$ for all primes $p$. A Wilson prime is a prime $p$ such that $p^2$ divides $(p-1)!+1$. – Hagen von Eitzen Dec 27 '12 at 18:48

A Wilson prime is a prime $p$ such that $p^2$ divides $(p-1)!+1$.

So you need to check that $169$ divides $12!+1$.

Remark: By Wilson's Theorem (called that despite the fact it was never proved by Wilson) $(p-1)!+1$ is always divisible by $p$ if $p$ is prime. The prime $p$ is called a Wilson prime if $(p-1)!+1$ has at least one "extra" factor of $p$.

share|cite|improve this answer
"...because it was never proved by Wilson" or "despite the fact that it was never proved by Wilson?" – Thomas Andrews Dec 27 '12 at 18:53

To prove that $13$ is a Wilson prime, you need to show that

$$12! \equiv -1 \pmod {13^2} \,.$$

To make the computations faster, observe that

$$12!= 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6 \cdot 7 \cdot 8 \cdot 9 \cdot (2 \cdot 5)\cdot 11 \cdot (4 \cdot 3)$$

We split the product in three:

$$2 \cdot 3 \cdot 4 \cdot 7 =(2 \cdot 7)(3 \cdot 4)=(13+1)(13-1)\equiv -1 \pmod {13^2} $$ Also $$6 \cdot 11 \cdot 8 \cdot 2 \cdot 4 = (6 \cdot 11)(8 \cdot 8)=(5 \cdot 13+1)(5 \cdot 13-1) \equiv -1 \pmod{13^2}$$

and $$ 5 \cdot 9 \cdot \cdot 5 \cdot 3=25 \cdot 27=(2 \cdot 13-1)(2 \cdot 13+1) \equiv -1 \pmod {13^2} \,.$$

Multiplying we get

$$12! \equiv -1 \pmod{13^2} \,.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.