# Proving $2^x$ is only ever 9 less than a perfect square for a unique value of x

I am trying to prove something that has essentially boiled down to proving that $9 + 2^x$ will only ever be a perfect square for the unique value of x=4, and that no other value will produce a perfect square. First, I am not sure if this always holds true, but it is valid for a few small values I checked.

I need to prove that $9 + 2^x = k^2$ only when $x=4$, and where $k$ is an integer. I tried reducing $\text{mod } 9$ to get

$$2^x \equiv k^2 \text{ (mod 9)}$$ and I know that squares modulo 9 will be 0, 1, 4, or 7. However, after this I am stuck and do not know how to proceed.

-
An approach modulo $m$ is likely not to work, or at least not simply. For there is a solution. Thus we cannot expect to reach a contradiction using modular considerations. –  André Nicolas Jun 3 '14 at 4:52

Hint: $2^x+9=k^2$ if and only if $2^x = k^2-9 = (k-3)(k+3)$. Thus $k-3$ and $k+3$ must be powers of $2$.
Do you then show that beyond a certain value for x, the two powers will always differ by more than 6: $2^n-2^{n-1}>6 \text{ for } n\geq 4$? However, how do you relate $n$ back in terms of $x$ and $k$? –  1110101001 Jun 3 '14 at 4:56
@user2612743: The powers of $2$ needn't be consecutive. Notice that, when $s<t$, $2^t-2^s = 2^s(2^{t-s}-1) = 6$ implies $s=1$ by the fundamental theorem of arithmetic, so $2^{t-1}-1=3$, so $t=3$. Hence $k=\frac{1}{2}(2^3+2^1) = 5$, so $2^x + 9 = 5^2$, so $x=4$. –  Clive Newstead Jun 3 '14 at 12:51
$2^x$ need not be a square. –  ronno Jun 3 '14 at 6:15