# Solution to puzzle 137: Factorial plus one equals prime power?

Observe that

- (2 − 1)! + 1 = 2
^{1}, - (3 − 1)! + 1 = 3
^{1}, - (5 − 1)! + 1 = 5
^{2}.

Are there any other primes p such that (p − 1)! + 1 is a power of p?

Suppose (p − 1)! + 1 = p^{n}, for p 7 and some positive integer n. Subtracting 1 from both sides of the equation, and dividing by p − 1, we get

(p − 2)! = p^{n−1} + p^{n−2} + ... + p + 1. (1)

We now show that if m is a composite integer greater than 4, then (m − 1)! is divisible by m.

We write m = ab, where 1 < a < m and 1 < b < m.

If a b, then both a and b appear in the product (m − 1)!, which is therefore divisible by m.

If a = b, then m = a^{2} and, since m > 4, 1 < a < 2a < m, and thus a appears (at least) twice in the product (m − 1)!, which is therefore divisible by m.

The result follows.

Since p − 1 > 4 is composite, in (1) we conclude that (p − 2)! is divisible by p − 1.

Writing the right-hand side of (1) as

(p^{n−1} − 1) + (p^{n−2} − 1) + ... + (p − 1) + (1 − 1) + n,

it follows that n is divisible by p − 1, and hence n p − 1.^{ }

But then clearly p^{p−1} > (p − 1)! + 1, and we have reached a contradiction.

Therefore, (p − 1)! + 1 is *not* a power of p, for any prime p > 5.

## Remarks

Combined with Wilson's Theorem, the above result, that (m − 1)! is divisible by m for all composite m > 4, tells us that (n − 1)! is congruent modulo n to:

- −1, if n is prime,
- 2, if n = 4,
- 0, if n > 4 and composite.

A prime p is known as a Wilson prime if p^{2} divides (p − 1)! + 1. The only known Wilson primes are 5, 13, and 563; there are no others less than 5×10^{8}. See also Online Encyclopedia of Integer Sequences: A007540.

Source: Topics in the Theory of Numbers (Section 7.19), by Paul Erdös and János Surányi

Back to top