Odd Numbers not Sum of Prime and Power

Theorem
The sequence of odd numbers which cannot be expressed as the sum of a perfect power and a prime number begins:
 * $1, 5, 1549, 1 \, 771 \, 561, \ldots$

It is not known if there are any more terms.

Proof
The cases $1$ and $5$ are trivial.

Now we show that $1549 - a^b$ is never prime for $a \ge 1$ and $b \ge 2$.

It suffices to show the result for prime values of $b$.

We first prove:

For $(1)$:

Suppose $a$ is odd.

Then so is $a^b$.

Therefore $1549 - a^b$ is even.

Hence $1549 - a^b$ is prime only if it is equal to $2$.

But $1547$ is not a perfect power.

For $(2)$:

Suppose $b = 2$ and $a$ is not divisible by $3$.

By Corollary to Square Modulo $3$:
 * $3 \divides \paren {a^2 - 1}$

Hence:
 * $3 \divides \paren {1548 - a^2 + 1} = 1549 - a^b$

So $1549 - a^b$ is prime only if it is equal to $3$.

But $1546$ is not a perfect square.

For $(3)$:

Suppose $a^b \equiv 4 \pmod {10}$.

Then $1549 - a^b \equiv 5 \pmod {10}$

So $1549 - a^b$ is prime only if it is equal to $5$.

But $1544$ is not a perfect power.

Hence we only need to check the cases:
 * For $b = 2: \: 6^2, 12^2, 18^2, 24^2, 30^2, 36^2$ since $42^2 > 1549$
 * For $b \ne 2: \: 2^3, 2^5, 2^7, 4^3, 4^5, 6^3, 8^3, 10^3$ since $2^{11}, 4^7, 6^5 > 1549$

of which $12^2 \equiv 18^2 \equiv 4^3 \equiv 4^5 \equiv 4 \pmod {10}$, so they are rejected.

We have:

and none of the above are prime.

For $11^6$, note the factorizations from Difference of Two Powers:


 * $11^6 - m^2 = \paren {11^3 - m} \paren {11^3 + m}$
 * $11^6 - n^3 = \paren {11^2 - n} \paren {1 + 11^2 n + 11^4 n^2}$

therefore if $11^6 - a^b$ is a prime, $b$ cannot be divisible by $2$ or $3$, unless $11^3 - m$ or $11^2 - n$ is equal to $1$.

For $m = 11^3 - 1$ and $n = 11^2 - 1$:


 * $11^6 - m^2 = 2661 = 3 \times 887$
 * $11^6 - n^2 = 1757161 = 7 \times 173 \times 1451$

and both are not primes.

Hence none of the above cases hold.

Since $\log_2 \paren {11^6} \approx 20.8$, we must have $b \le 19$.

By the conditions above, $b$ can only be one of $5, 7, 11, 13, 17, 19$.

Moreover $a$ cannot be odd unless $11^6 - a^b = 2$.

However $11^6 - 2 = 1771559$ is prime, and thus not a perfect power.

The cases we need to check are:


 * $a^b = 2^5, 6^5, 10^5, 12^5, 14^5, 2^7, 6^7, 2^{11}, 2^{13}, 2^{17}, 2^{19}$

since $18^5, 10^7, 6^{11} > 11^6$, and $4, 8, 16$ are square/cube.

We have:

and none of the above are prime.