TITLE: Show $3^m + 3^n +1$ cannot be a perfect square for $m,n$ being positive integers.
QUESTION [5 upvotes]: So, I decided to work with mod $8$ to help develop some intuition on how to generalize the proof. I noticed that taking $a^2$ to clearly be a perfect square, $a^2$ is always congruent to $0,1,-4,4 \mod 8$, at least for a good finite set of cases. Also, I played around with solutions to $3^m + 3^n + 1 = b$ and seen again for a finite set of cases with $m,n$ varying these were always, $b$ is congruent to $-1,5,-5,3$. Now, I see that well only perfect squares produce a set $\{0,1,-4,4\} \mod 8$ and none of the cases I tried to $m,n$ gave me any of the numbers in this set. And now I'm stuck.

REPLY [3 votes]: The simple modulo 8 approach in the question works fine, you just have to extend "try some random samples" on each side to actual proofs.
You can prove that $3^n \bmod 8$ is always either $1$ or $3$, by induction on $n$. From this you can see that $3^n+3^m+1$ is equivalent modulo 8 to either one of $1+1+1=3$ or $3+1+1=1+3+1=5$ or $3+3+1=7$.
On the other hand all perfect squares are either $0$, $1$, or $4$ modulo 8 (which you can see by squaring $0,1,2,\dots,7$ and taking each of them modulo 8).
Since $\{3,5,7\}$ and $\{0,1,4\}$ don't have any possibilities in common, the desired result follows.