Skip to main content.

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

Skip restatement of puzzle.Observe that

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


Suppose (p − 1)! + 1 = pn, for p greater than or equal to 7 and some positive integer n.  Subtracting 1 from both sides of the equation, and dividing by p − 1, we get

(p − 2)! = pn−1 + pn−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 not equal to b, then both a and b appear in the product (m − 1)!, which is therefore divisible by m.
If a = b, then m = a2 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
(pn−1 − 1) + (pn−2 − 1) + ... + (p − 1) + (1 − 1) + n,
it follows that n is divisible by p − 1, and hence n greater than or equal to p − 1. 

But then clearly pp−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:

A prime p is known as a Wilson prime if p2 divides (p − 1)! + 1.  The only known Wilson primes are 5, 13, and 563; there are no others less than 5×108.  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