Exercise 1590Number theory › CongruencesOlympiadAdded 3 Nov 2026
Wilson's theorem
#Wilson theorem#prime#factorial
Statement
Show that is prime iff .
Hint
If is prime, pair each with its inverse mod ; only are self-inverse.
Show solutionHide solution
Solution
prime . Among , pair with . The only self-inverse elements satisfy , i.e. . All other pairs multiply to , so .
Converse. If composite and : has a proper divisor with , so , and ; thus , so . (Small cases: , .)
Conclusion. Wilson's criterion holds.
Application. : . Correct.