# Proof related with prime numbers and congruence

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

-
– lab bhattacharjee Nov 19 '13 at 16:58
$$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

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