What is the remainder when $(p-1)!$ divisible by $p(p-1)$, where $p$ is a prime number? [duplicate]
My attempt:
by Wilson's theorem, $(p-1)!=p⋅A-1$. Let $(p-2) !=p \cdot B+r$, where $0 \leq r<p$. Multiply the last equality by $(p-1)$:
$$(p-1) !=p \cdot B \cdot(p-1)+p \cdot r-r=p \cdot(B \cdot(p-1)+r)-r.$$
Comparing with the first equality, we get that $r=1$.
But my textbook says that $p-1$... Am I wrong?
Solution 1:
You are not at all wrong. Because the answer required is not $r$. What is $r$? It is simply the remainder obtained when $(p-2)!$ is divided by $p$. But you are required to find the remainder obtained when $(p-1)!$ is divided by $p(p-1)$, which is clearly not $r$. You need to find the number $s$ such that $0\leq s < p(p-1)$ and that $$ (p-1)! \equiv s \pmod{p(p-1)}.$$
You have done it already. All you need is to note that $r=1$ (Why?). From your second equality it follows that $$(p-1)! = p(p-1)B + (p-1).$$ The above clearly implies that $s = p-1$.