TITLE: Prove that the equation $3^k = m^2 + n^2 + 1$ has infinitely many solutions in positive integers.
QUESTION [8 upvotes]: Prove that the equation $3^k = m^2 + n^2 + 1$ has infinitely many solutions in positive integers.

I have found that this is true for the first $k$'s from 1 to 7 except 3 and 6.
I have tried algebraic manipulation and induction too and it doesn't seem to work. I believe induction won't work since there are exceptions.
If I am correct, the numbers $m^2$ and $n^2$ can only be of the form $3a+1$.
Do you have any ideas about how I should proceed with this? I would love a few hints. Thanks.

REPLY [2 votes]: Hint: Prove that if $a^2-1$ is a sum of two square, then $a^{4}-1$ is a sum of two squares. 
Thus if $3^{2k}-1$ is the sum of two squares for some $k$, then so is $3^{2^nk}-1$ for any $n$. (You can also prove if $3^{2k}-1$ is the sum of two squares, then so is $3^{k}-1$.) 
The hint given by MXYMXY is just the case $k=1$. 
The case $k=5$ also has this property, because $$3^{10}-1=(3^5-1)(3^5+1)=8 \cdot 11^2\cdot 61=(11\cdot 22)^2 + 22^2$$ is the sum of two squares. So $3^{5\cdot 2^n}-1$ is always the sum of two squares.