LearnViz Math
Expert ⛓ Discrete Math & Number Theory Topic 84 of 103

Wilson’s Theorem

p is prime iff (p−1)! ≡ −1 mod p.

Key idea

p is prime iff (p−1)! ≡ −1 mod p.

In depth

For a prime p, (p − 1)! ≡ −1 (mod p), and the converse holds as well. It gives a primality test, though too slow to be practical.

Worked example

p = 5: 4! = 24 ≡ −1 (mod 5), since 24 + 1 = 25.

Real-world uses

Common mistake

Thinking it is a practical primality test.

How to learn this

  1. Read the key idea and say it in your own words.
  2. Work through the worked example, then try a similar problem.
  3. Use the interactive lesson’s visual and mini-quiz to check the pattern.

Frequently asked questions

What is Wilson’s Theorem?

p is prime iff (p−1)! ≡ −1 mod p. It is a topic at the expert level in Discrete Math & Number Theory.

Where is Wilson’s Theorem used in real life?

Real-world examples: A theoretical test for primes used in number theory and olympiad problems.

What should I learn before Wilson’s Theorem?

Make sure you are comfortable with Euler’s Theorem, the previous topic in Discrete Math & Number Theory.

What is a common mistake with Wilson’s Theorem?

Thinking it is a practical primality test.

How can I practise Wilson’s Theorem?

Open the interactive lesson, play with the visual, then answer the three-question mini-quiz. Getting two right marks the topic complete.

What comes after Wilson’s Theorem?

Move on to Quadratic Residues next.

Related expert topics in Discrete Math & Number Theory