Find all solutions to p^{n} = q^{m} ± 1, where p and q are primes and m, n ≥ 2.

**Solution**

Answer: 2^{3} = 3^{2} - 1.

p^{n} and q^{m} have opposite parity, so one must be even. So without loss of generality we may take p = 2. Now q^{m} ± 1 factors as (q ± 1) and a sum of m powers of q, each of which is odd. If m is odd, then the sum is odd, but that is impossible, since 2^{n} has no odd factors. So m is even. Take it to be 2M.

Consider first the case 2^{n} = q^{2M} - 1 = (q^{M} + 1)(q^{M} - 1). But q^{M} + 1 and q^{M} - 1 are successive even numbers, so one of them has an odd factor (which is impossible) unless then are 4 and 2. Thus the only solution of this type is 2^{3} = 3^{2} - 1.

Finally consider 2^{n} = q^{2M} + 1. q^{M} is odd, so put q^{M} = 2N + 1, then q^{2M} + 1 = 4N^{2} + 4N + 2, which is not divisible by 4. So n = 1 and q = 1, which is not a solution, since 1 is not prime.

© John Scholes

jscholes@kalva.demon.co.uk

23 Jan 2001