Here’s an interesting characterization of primes:
Wilson’s Theorem. A number P is prime if and only if
(P-1)! + 1 is divisible by P.
Let’s check:
(2-1)!+1 = 2, which is divisible by 2.
(5-1)!+1 = 25, which is divisible by 5.
(9-1)!+1 = 40321, which is not divisible by 9 (cast out nines to see this).
Pretty cool!
The Math Behind the Fact:
However it is not really practical to use this to test if a number is prime, especially if P is large: just try P=101, and you’ll see what I mean! There are better primality tests available; you can learn about some of them in a number theory class. See also Fermat’s Little Theorem.
How to Cite this Page:
Su, Francis E., et al. “Wilson’s Theorem.” Math Fun Facts. <https://www.math.hmc.edu/funfacts>.
Fun Fact suggested by:
Jorge Aarao