# Integers $n$ for which $|2^n + 5^n – 65|$ is a perfect square

Find the sum of all positive integers $$n$$ for which $$|2^n + 5^n– 65|$$ is a perfect square.

It is easy to check for $$n<3$$ only $$n=2$$ works. Looking at $$n≥3$$, $$2^n + 5^n– 65= a^2$$ For odd $$n$$, LHS has unit digit $$2$$ or $$8$$ but RHS has unit digit $$0,4$$ or $$6$$. Hence $$n$$ cannot be odd. For even $$n$$ we can rewrite our expression as follows ($$n=2k$$): $$(a – 2^k)(a+2^k)=5(5^{2k–1} – 13)$$

But I wasn't able to finish off after this. Both LHS and RHS have the same unit digit ($$0$$). Through trial and error I found that $$n=4$$ works, but $$n=6,8$$ don't. Since the questions asks for the sum as is common in Olympiad number theory it's highly unlikely that any other larger values satisfy. I also tried some alternative ways like looking at the equation modulo $$4$$ but that didn't help.

Once you know that $$n\geq 3$$ must be even, let $$n = 2k$$.

Then, apart from finitely many values of $$k$$,

$$5^{2k} < 5^{2k} + 2^{2k} - 65 < 5^{2k} + 2 \times 5^k + 1.$$

This bounds the expression strictly between 2 consecutive perfect squares, so it cannot be a perfect square.

So, we just need to check those finitely many values, which is left as an exercise to the reader.

• I think some of the inequalities go the other way here...
– Mike
Jan 19, 2021 at 14:45
• @Mike Which ones? Note the "apart from finitely many values of $k$", esp for small $k$. Jan 19, 2021 at 14:45
• @Mike valid question but in this case the function $f(x)=2\cdot 5^x-2^{2x}$ increases for $x\ge 1$ so Calvin Lin's point is correct Jan 19, 2021 at 14:49
• Yes you are right...You are using the fact that the difference between $5^{2k}$ and the next square is at least $5^{k} >> 2^{2k} \pm 65$. I had read the sentence you wrote wrong, my mistake
– Mike
Jan 19, 2021 at 14:52
• @Mike Yes, I'm using the fact that $5 \geq 4$ for the RHS. IE This approach wouldn't have worked out if it was for $|3^n + 2^n - 65 |$ Jan 19, 2021 at 14:54

NOTE: This is not a full answer and is intended to give a boost.

Taking modulo $$4$$, $$a^2-(0)^k\equiv 0\ (\text{mod}\ 4)$$ $$a\equiv0\ (\text{mod}\ 4)$$ Taking modulo $$3$$, $$a^2\equiv(-1)^n+(-1)^n-2\equiv 0\ (\text{mod}\ 3)$$ $$a\equiv0\ (\text{mod}\ 3)$$ Therefore, $$a$$ must be divisible by $$12$$.

Hope this part helps :)

EDIT: @CalvinLin has a wonderful (intended too I guess), so this will be left as intact, or if I should delete this, tell me.

• Can you narrow down further, in particular $n$ to a finite set
– Mike
Jan 19, 2021 at 14:42
• Please start off by saying this is a partial answer else people may get confused Jan 19, 2021 at 14:44
• @AlbusDumbledore: Done! Jan 19, 2021 at 15:03
• ok,see Calvin Lin's complete answer too Jan 19, 2021 at 15:04
• It's still useful, if not a complete answer , or even the right direction. Jan 20, 2021 at 8:57