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! :)

  • 2
    $\begingroup$ You multiplied $(p-1)!$ by $p-2$ and got $(p-2)!$. That is not correct. $\endgroup$ Oct 11, 2014 at 5:31

1 Answer 1


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$

  • $\begingroup$ Wish I know the mistake $\endgroup$ Oct 11, 2014 at 5:34
  • $\begingroup$ Me too. Let me know if you see it. $\endgroup$
    – ILoveMath
    Oct 11, 2014 at 5:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .