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$.

  • $\begingroup$ How do you prove that the last operation is valid.(The one where you multiply everything by $p$). $\endgroup$ Apr 3 '16 at 3:30
  • $\begingroup$ Oh! It follows from the definition of the congruent modulo function. +1 $\endgroup$ Apr 3 '16 at 3:34
  • 1
    $\begingroup$ 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$. $\endgroup$ Apr 3 '16 at 3:42
  • 1
    $\begingroup$ By the way, Leibniz was the first person to state the result that would later be called Wilson's Theorem. It is not known whether he had a proof. For sure Wilson did not! The first known proof is by Lagrange. $\endgroup$ Apr 3 '16 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.