Show that if $p> 2$ is a prime number, then $p$ divides $(p-2)! - 1$. I have tried using Fermat's Theorem, but I could not solve it.

  • $\begingroup$ Este site é inglês, se não escreveres a tua pergunta em inglês, vai ser apagada. (This site is in english, if you don't translate your question to english it will probably be deleted) $\endgroup$ – RGS Jan 28 '18 at 21:11
  • $\begingroup$ This is Wilson's theorem. $\endgroup$ – Lord Shark the Unknown Jan 28 '18 at 21:13

This follows from Wilson's theorem, which states that

$$(p-1)!\equiv_p -1$$ if and only if $p$ is a prime

If you accept this, then the rest follows easily since $(p-1)!\equiv_p (p-2)!(-1)\equiv_p-1$ implies: $$(p-2)!\equiv_p 1$$ This is the same as saying that $p$ divides $(p-2)!-1$.

Now for the proof of this theorem. In $\mathbb{Z}_p$ every non-zero element has an inverse, in particular $-1$ and $1$ are their own inverses, which means that if you multiply all these numbers you'll get: $$1\cdot 2\cdot\ldots\cdot (p-1)=(p-1)!\equiv_p 1\cdot 1\cdot\ldots\cdot 1\cdot (-1)\equiv_p-1$$

  • $\begingroup$ Why is this being downvoted? $\endgroup$ – cansomeonehelpmeout Jan 28 '18 at 22:25

If given $p>2$: $p$ divides $(p-2)! -1$ if and only if there is an $n \in \mathbb{Z}$ for which $$(p-2)! -1 = np \iff (p-2)! = 1 + np$$

Modular arithmetic says an equivalent thing then:

$$(p-2)! \equiv 1 \mod p \iff (p-1)!=(p-1)(p-2)! \equiv p-1 \mod{p} $$ $$\equiv -1 \mod p$$ And this, if and only if, $p$ is a positive prime number. (Wilson's Theorem)

More clearly now:

$p>2$ is a prime number is equivalent to $p>2$ being a divisor of $(p-2)!-1$.


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.