$\large 5 \times 3^m + 4 = n^2$

Consider all possible integers $n \ge 0$ such that the equation above holds true for some corresponding integer $m \ge 0$ . Find the sum of all such $n$ .

The answer is 10.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

$(5 \times 3^m) + 4 = n^2 \\ \implies (5 \times 3^m) = (n+2)(n-2)$

Notice that LHS has two coprime factors. In the RHS $\text{gcd}(n+2,n-2) = \text{gcd}(4,n+2)$ (as $\text{gcd}(a+b,a-b) = \text{gcd}(a+b,2b)$ ), here, $n+2$ should be odd which means that gcd is 1, hence RHS must contain both factors coprime as well.

Hence

$n+2 = 5 \implies n=3$

$n-2 = 5 \implies n=7$

We can check that

$n=3 \to 5 \times 3^m = 5 \implies m = 0 \ (m : m \in \mathbb{Z}, m \ge 0)$

$n=7 \to 5 \times 3^m = 45 \implies m = 2 \ (m : m \in \mathbb{Z}, m \ge 0)$

Thus the sum is $3+7 = 10$ .