Factorials and the Mod function

3.3k Views Asked by At

I was just playing with the factorial and the modulo function. I just observed this interesting property. I was using a calculator

$$13!\equiv 13\times 12\pmod{169}\\ 17!\equiv 17\times 16\pmod{289}$$

It is easily verifiable that this works for $2,3,5,7,11$ also.

I conjecture that for any prime $p$, $$p!\equiv (p)\times (p-1)\pmod{p^2}$$

How does one go about proving it? and by the way is this well known or anything?

1

There are 1 best solutions below

4
On BEST ANSWER

By Wilson's Theorem we have $(p-1)!\equiv -1\equiv p-1\pmod{p}$. Your conjectured result is obtained by multiplying through by $p$.