Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to (dis)prove this

$ (n-2)! \equiv 1 \mod n$

If n is said to be a prime number. I guess we'll have to use FERMAT’S LITTLE THEOREM, and I just don't know where to start from. Thanks in advance

share|cite|improve this question
$$n=4\;,\;\;(n-2)!=2!=2\neq 1\pmod 4$$ – DonAntonio Nov 19 '13 at 16:59
but 4 is not a prime number! – Bledi Boss Nov 19 '13 at 16:59
Exactly @BlediBoss, so your claim is false unless you require $\;n\;$ to be a prime. Check my answer. – DonAntonio Nov 19 '13 at 17:00
@DonAntonio that looks promising :) – Bledi Boss Nov 19 '13 at 17:04
up vote 6 down vote accepted

If $\;n=p\;$ is a prime, then by Wilson's theorem

$$\color{red}{-1}=(p-1)!=(p-2)!(p-1)=\color{red}{-(p-2)!\pmod p}\implies 1= (p-2)!\pmod p$$

share|cite|improve this answer
I forgot to ask, how did you make that pass, I mean how do you eliminate $ (p-1) $ – Bledi Boss Nov 19 '13 at 18:54
@BlediBoss , $\;p-1=-1\pmod p\;$ , of course. – DonAntonio Nov 19 '13 at 19:44
But do we need a proof for it? – Bledi Boss Nov 19 '13 at 19:45
@BlediBoss, it folllows directly from the definition of modular equality! $\;a=b\pmod p\iff p\mid (a-b)\;$ , so in our case $\;p-1=-1\pmod p\iff p\mid(-1-(p-1))\iff p\mid p\;$...what, do you think this is trivial or what? :) – DonAntonio Nov 19 '13 at 19:50
Great job buddy. – Bledi Boss Nov 19 '13 at 19:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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