Using Wilson's Theorem

237 Views Asked by At

I'm working through an exercise which involves Wilson's Theorem:

Let $n \in \mathbb{Z}$ with $n>1$. Prove that n is a prime number if and only if $(n-2)!\equiv 1 \pmod n$

So far I have :

($\rightarrow$) Suppose n is a prime number, by Wilson's theorem we know that $(n-1)!\equiv -1 \pmod n$. If we divide $(n-1)$ from both sides we get $(n-2)! \equiv 1 \pmod n$.

I'm not really sure how to get started on the opposite direction. Any hints?

2

There are 2 best solutions below

0
On

Hint: if $n$ is not prime then it has a prime divisor $k \leq n/2$. If $n \geq 4$ then $n/2 \leq n-2$ and so $k \mid (n-2)!$, which contradicts $(n-2)! \equiv 1 \pmod{n}$.

0
On

$n$ is a prime iff $(n-1)!\equiv -1 \bmod n$. That's Wilson's theorem.

The result follows because $n-1\equiv -1 \pmod n$ :

In one direction, just cancel $n-1$ on the left with $-1$ on the right of $(n-1)!\equiv -1$.

In the other direction, just multiply both sides of $(n-2)!\equiv 1$ by $-1$.