Wilson's theorem

For an integer j2:

(j1)!+10(modj)j is prime.

Equivalently, j(j1)!+1 precisely when j is prime (and trivially when j=1).

Consequence: This gives a primality criterion — in principle it detects primes, though computing (j1)! makes it impractical for large j.but

Related: prime counting function, prime number theorem.