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.
$2^{2k+1}+2=(2^k-1)^2+(2^k+1)^2$.