# Show $3^m + 3^n +1$ cannot be a perfect square for $m,n$ being positive integers.

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.

• Note that $$4\equiv -4\bmod 8$$ and $$-5\equiv 3\bmod 8$$ – Zev Chonoles Jun 14 '13 at 3:31
• I'm sorry, I'm not following where this is going. – Mr.Fry Jun 14 '13 at 3:36
• I wasn't trying to give you a hint on the problem (you're actually basically done already), I was just pointing out that it is redundant to list $4\bmod 8$ and $-4\bmod 8$ separately, and likewise, $-5\bmod 8$ and $3\bmod 8$ separately. – Zev Chonoles Jun 14 '13 at 3:37
• Ah, yeah I see what you mean. Sorry about that. I was just pondering whether I can end this knowing that from a finite set of m,n cases we can see a pattern of solutions that do not match those of perfect squares. – Mr.Fry Jun 14 '13 at 3:41

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.

• I can do this problem now. This is from my first course I took in abstract algebra over this past summer. – Mr.Fry Feb 24 '14 at 4:33
• @Hey123: Nevertheless it seems worthwhile to have the straightforward solution on record ... – Henning Makholm Feb 24 '14 at 11:12

It's easy to see that $3^m + 3^n + 1$ is odd. Suppose that $3^m + 3^n + 1 = 4k^2 + 4k + 1$, then $3^m + 3^n \equiv 0 \pmod 8$. We can suppose $m \geq n$ by symmetry, then $3^n(3^{m-n} + 1) \equiv 0 \pmod 8$ and so $3^{m-n} \equiv -1 \pmod 8$. This is a contradiction because just $1$ and $3$ are residues of powers of $3$ modulo $8$.

• Can you just explain this a bit more to me. It seems like you used 4k^2+4k+1 because perfect squares can always be expressed this way. What if this wasn't common knowledge? And also can you particularly clarify the second line? Thanks a lot though! – Mr.Fry Jun 14 '13 at 4:12
• As $3^m + 3^n + 1$ is odd and we are assuming $3^m + 3^n + 1$ is a perfect square, it is a perfect square of a odd number, for example, $(2k+1)^2$. But $(2k+1)^2 = 4k^2 + 4k + 1 = 4k(k+1) + 1$. One of $k$ or $k+1$ is even, then $4k(k+1) \equiv 0 \pmod 8$ and so $3^m + 3^n + 1 = 4k^2 + 4k + 1 \equiv 1 \pmod 8 \Rightarrow 3^m + 3^n \equiv 0 \pmod 8 \Rightarrow 3^n(3^{m-n} + 1) \equiv 0 \pmod 8$, but $gcd(3,8) = 1$, then $3^{m-n} + 1 \equiv 0 \pmod 8$. Is it ok now? – Savio Jun 14 '13 at 4:30
• Yes, thanks alot. – Mr.Fry Jun 14 '13 at 4:34