# Find the remainder of $(p-2)!$ module $p$, where $p$ is a prime $\geq 3$

My attempt: From Wilson's Theorem: For a prime $p$,

$$(p-1)! \equiv (-1) \pmod p$$

Multiplying both sides by $(p-2)$,

$$(p-2)! \equiv -(p-2) \pmod p$$ i.e. $$(p-2)! \equiv 2 \pmod p$$

So the remainder is 2. But the answer is given to be 1. So where am I wrong?

EDIT: after being pointed out where I was wrong in the comment (THANK YOU!), I see:

$$(p-1)(p-2)! \equiv (-1) \pmod p$$ i.e. $$(-1)(p-2)! \equiv (-1) \pmod p$$ i.e. $$(p-2)! \equiv (1) \pmod p$$

So the remainder is 1. Thank you! :)

• You multiplied $(p-1)!$ by $p-2$ and got $(p-2)!$. That is not correct. – André Nicolas Oct 11 '14 at 5:31

As $p-1=p-2+1,(p-2)\cdot (p-1)!\ne (p-2)!$
and in fact $(p-1) \cdot (p-2)!=(p-1)!$
But $p-1\equiv-1\implies(-1)\cdot (p-2)!\equiv-1\implies (p-2)!\equiv1$