Let $q=\frac{p-1}{2}$ and $p$ is an odd prime. Show that $$(q!)^2+(-1)^q\equiv 0\:\:\text{mod p}$$ After searching for a while, I couldn't find this specific congurence question. So therefore I am asking for any help on this. 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.
1 Answer
Working in $\mathbb{Z}/(p)$, you have $$ q! = q \cdot (q-1) \cdots 2 \cdot 1 = (-1)^q (p-q) (p-q+1) \cdots (p-2) \cdot (p-1).$$
So then you have $$ (q!)^2 = (-1)^q (p-1)!$$ and Wilson's Theorem gives you the result you are after.