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?
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}$.