# Prove that $2^r +2$ is sum of 2 square number, when r is a prime number not equal to 2

I was doing a question. Suddenly I got stuck at this last part of the problem. It was to prove $$2^r +2 = a^2 +b^2$$ where $$r \neq 2$$, r is a prime and $$a \neq b$$. Also $$r^2 -1$$ is a mersenne prime. I tried to use fermat's little theorum, but to no avail. Thank you.

PS note: The problem I was solving was BMO2021 Q6.

• As it is a part of a question, it 'can' be incomplete in data. But most probably it is not. If you feel something more should have been provided, please point me out. Dec 13, 2020 at 14:34
• So why not provide as much relating details as possible? In most cases it helps others to help you with the problem you have Dec 13, 2020 at 14:36

## 3 Answers

$$2^{2k+1}+2=(2^k-1)^2+(2^k+1)^2$$.

• Ok. I was actually doubtful if it will be proved by doing so. Dec 13, 2020 at 15:22

The question is wrong. If $$r=11$$, $$2^{11}-7 = 2041$$ is not a square number.

• Thank you for pointing it. I have edited the question. Dec 13, 2020 at 14:43

Not a 'real' answer, but it was too big for a comment.

I wrote and ran some Mathematica-code:

In[1]:=Clear["Global*"];
n = 2;
ParallelTable[
If[TrueQ[2^r + 2 == a^2 + b^2 && a != b], {r, a, b}, Nothing], {r,
2, 10^n}, {a, 0, 10^n}, {b, 0, 10^n}] //. {} -> Nothing


Running the code gives:

Out[1]={{{{3, 1, 3}}, {{3, 3, 1}}}, {{{5, 3, 5}}, {{5, 5, 3}}}, {{{7, 3,
11}}, {{7, 7, 9}}, {{7, 9, 7}}, {{7, 11, 3}}}, {{{9, 15,
17}}, {{9, 17, 15}}}, {{{11, 5, 45}}, {{11, 23, 39}}, {{11, 31,
33}}, {{11, 33, 31}}, {{11, 39, 23}}, {{11, 45, 5}}}, {{{13, 25,
87}}, {{13, 63, 65}}, {{13, 65, 63}}, {{13, 87, 25}}}}
`

So, we can see that you're not right! Because, for example, when $$\text{r}=9\notin\mathbb{P}$$ we get $$2^9+2=15^2+17^2$$.

• See, I never said that it is going to be false for composite numbers. It can also be true for some composite numbers. Dec 13, 2020 at 14:53