Factorials and the Mod function

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?

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$.
• How do you prove that the last operation is valid.(The one where you multiply everything by $p$). Apr 3 '16 at 3:30
• Yes, it is very close to Wilson's Theorem. We have $p(p-1)!-p(p-1)$ is divisible by $p^2$ if and only if $(p-1)!-(p-1)$ is divisible by $p$. Apr 3 '16 at 3:42