For which primes $p$ is $(p-6)! \equiv 1 \mod p$ defined?

I brute forced it by repeatedly trying lots of primes and ended up with $p=7, p=17$. Does anyone have a better method to do this?

  • 5
    $\begingroup$ Hint: $(p-1)! = -1 \mod p$ $\endgroup$ – Vladislav Kharlamov May 10 '18 at 23:04
  • $\begingroup$ Adding to what @VladislavKharlamov said, this is known as Wilson's Theorem. $\endgroup$ – Mr Pie May 11 '18 at 1:16

We rewrite our expression as: $$ (p-1)!(p-5)^{-1}(p-4)^{-1} \ldots (p-1)^{-1} \equiv 1 \mod p$$ Using Wilson's theorem we get: $$ -(p-5)^{-1}\ldots(p-1)^{-1} \equiv 1 \mod p$$
But $$ (p-5)^{-1}(p-4)^{-1} \ldots (p-1)^{-1} \equiv (-5!)^{-1} \mod p $$ Then, need find $p$ : $$ -(-5!)^{-1} \equiv 1 \mod p \Leftrightarrow 5! \equiv 1 \mod p$$
It is clear that if the simple is more than 120, then the remainder will not exactly be equal to 1, it remains to sort out the cases less, or try to come up with something else.

  • 4
    $\begingroup$ In other words, $p$ must divide $5!-1 = 119$. Not too many of those... $\endgroup$ – Robert Israel May 10 '18 at 23:23
  • 1
    $\begingroup$ I wanted the OP to take the last step myself :) $\endgroup$ – Vladislav Kharlamov May 10 '18 at 23:25
  • 1
    $\begingroup$ It might be worth rephrasing the start of this; it kind of looks right now that you're saying that Wilson's theorem at the first step, whereas you're just rewriting the equation we're examining so that you can use Wilson's theorem at the second step. $\endgroup$ – Milo Brandt May 11 '18 at 0:06
  • $\begingroup$ That's better? ... $\endgroup$ – Vladislav Kharlamov May 11 '18 at 0:14

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.