All topics

s3.5.3

Wilson's Theorem

1,000 questions

Wilson's Theorem states that for a prime number pp, the factorial (p1)!(p-1)! is congruent to 1-1 (or p1p-1) modulo pp.

(p1)!1(modp)(p-1)! \equiv -1 \pmod{p}

This theorem is useful for problems asking for the remainder of a factorial when divided by a prime number. For example, for 6!(mod7)6! \pmod{7}, since 7 is prime, Wilson's Theorem applies directly: 6!16(mod7)6! \equiv -1 \equiv 6 \pmod{7}.

If the modulus is not prime, you must check for common factors and simplify. For example, 4!=244! = 24, so 4!0(mod6)4! \equiv 0 \pmod{6}.

Practise this