Wilson's Theorem - Why only for primes?

829 Views Asked by At

Why is it true that Wilson's Theorem only holds for prime numbers?

I read a proof of it, and it did not seem to cater to that aspect of the theorem.

1

There are 1 best solutions below

4
On BEST ANSWER

If $m$ is not a prime, it factors into two numbers smaller than $m-1$, thus we have $m \mid (m-1)!$ and $(m-1)! \equiv 0 \mod m$ if those factors are different.

If these numbers are not different, then it is sufficient to have $\sqrt{m}$ and $2\sqrt{m}$ as factors. As we have $2\sqrt{m}<m-1$ for $m\geq9$, the only other case is $m=4$, in which case we have $(m-1)! \equiv 2 \mod m$.