Wilson's theorem, $(p-2)! \bmod p$ and $(p-3)! \bmod p$

810 Views Asked by At

According to Wilson's theorem, when $p$ is prime

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

What's the remainder in cases of

$$(p-2)! \mod p$$

or

$$(p-3)! \mod p$$

Can these be solved using Wilson's theorem also?

2

There are 2 best solutions below

1
On BEST ANSWER

From Wilson theorem we have,

$(p-1)!=-1$ for $p$ prime. Now suppose $(p-2)!=x$, then $(p-1)!=(p-1)(p-2)!=(p-1) x=-1 \pmod p$.This implies $x=1\pmod p$.

0
On

Hint: Multiply by the multiplicative inverses of $p-1$ and $p-2$.