Let $q=\frac{p-1}{2}$ and $p$ is an odd prime. Show that
$$(q!)^2+(-1)^q\equiv 0 \pmod{p}.$$
I know that I have to use Wilson's Theorem somehow, I am just completly lost at how to do so. Any help would be greatly appreciated.
elementary-number-theorymodular arithmetic
Let $q=\frac{p-1}{2}$ and $p$ is an odd prime. Show that
$$(q!)^2+(-1)^q\equiv 0 \pmod{p}.$$
I know that I have to use Wilson's Theorem somehow, I am just completly lost at how to do so. Any help would be greatly appreciated.
Best Answer
This theorem can be easily proved with complete induction on $n$ and with Wilson's theorem. If you set $n=\frac{p+1}{2}$ here, the result is:
This is what you want.
You can also prove your statement directly, as a hint, use that: $$\begin{aligned} p-1 &\equiv-1 \pmod{p}\\ p-2 &\equiv-2 \pmod{p}\\ & \hspace{2.25mm}\vdots \\ \frac{p+1}{2} &\equiv-\frac{p-1}{2} \pmod{p} \end{aligned}$$