<s>[INST] Find all natural numbers $n$ such that $3^n+81$ is a perfect square. Find all natural numbers $n$ such that $3^n+81$ is a perfect square.
My solution:
$3^n=a^2-81 \Rightarrow 3^n=(a-9)(a+9)$
$gcd(a-9,a+9) \mid 18$
because $a+9>a-9$ then $a-9$ can be $1,3,9$that only $a=9$ is the answer so we have only one solution.I just wanted to verify my answer is it right?
 [/INST] You get $3^n = (a-9)(a+9)$ in the question.  But the only factors of $3^n$ are other powers of $3$, so you need $a-9$ and $a+9$ to both be powers of $3$. The only powers of three differing by $18$ are $9$ and $27$.  So $a = 18$, and the only solution is $18^2  = 3^5 + 81$.
</s>