Exercise 1337Number theory › CongruencesOlympiadAdded 5 Nov 2026
((p − 1)/2)! modulo a prime p ≡ 3 (mod 4)
#Wilson's theorem#factorials modulo p#quadratic residues
Statement
Let be a prime and . Prove that .
Hint
Pair with in Wilson's product .
Show solutionHide solution
Solution
Pairing. Wilson's theorem: . Write
Parity of . Since , is odd, so .
Conclusion. , i.e. . Since is prime, .
Check. : . : . : .
Remark. For the same computation gives , which is the key to writing such a prime as a sum of two squares.
Lesson. Wilson's theorem plus the pairing turns into a square (up to sign) of half the product.