Find all positive integers $`n$' such that $$3^{2n}+3n^2+7$$ is a perfect square.
My attempt:
$9^n\equiv 1 \mod 4, 7 \equiv3 \mod 4$.
Also if $n$ is odd, $n^2\equiv1\mod 4 \implies 3n^2\equiv 3\mod 4$
Thus $9^n+3n^2+7\equiv7\mod4$ and therefore $9^n+3n^2+7\equiv3\mod4$
This means that $9^n+3n^2+7$ cannot be a perfect square when $n$ is odd.
If $n$ is even. Let $n=2k,k\in \mathbb{N}$
So we have $3^{2n}+3n^2+7=3^{4k}+12k^2+7$
We observe that if $k>1,$ then
$2k^2+1<3^{2k-1}$
$6(2k^2+1)<2\cdot 3^{2k}$
$12k^2+6<2\cdot 3^{2k}$
$12k^2+7<2\cdot 3^{2k}+1$
$3^{4k}+12k^2+7<3^{4k}+2\cdot 3^{2k}+1$
$3^{4k}<3^{4k}+12k^2+7<3^{4k}+2\cdot 3^{2k}+1$
$(3^{2k})^2<3^{4k}+12k^2+7<(3^{2k}+1)^2$
This implies that if $k>1,3^{4k}+12k^2+7$ cannot be a perfect square.
If $k=1,$ i.e., if $n=2,$ we have
$3^{2n}+3n^2+7=81+12+7=100$ which is a perfect square.
Hence $n=2$ is the only solution.
Is there any other way to polish this argument? I had to work my way backwards in the $n$ is even case. Is there any better argument?
Best Answer
Can't you instead observe that $3^{2n}$ is a perfect square for all nonnegative integers $n$, and that the next perfect square sfter $3^{2n}=(3^n)^2$ is $(3^n+1)^2=3^{2n}+(2\times3^n)+1$, which must be larger than $3^{2n}+3n^2+2$ for $n \ge 3$ [because $(2 \times 3^n)+1$ must be larger than $3n^2+2$ for all such $n$].