<s>[INST] $3\times 2^m + 4 = n^2$ I have been trying to solve this problem but I couldn't find any way to find the answers. Find all natural numbers m and n such that:
$3\times\ 2^m + 4 = n^2$
This is a question from the Moroccan Maths Olympiad (2019.)
I tried bringing $4$ to the other side and factorising to get: $3\times 2^m=(n+2)(n−2),$ and I tried solving for that $n+2$ is a multiple of three then $n-2$ is a multiple of three but I couldn't find anything.
Can anyone help me please?
 [/INST] Assume that $m, n \in \mathbb{N}$. From the equation, you can deduce that $$2 \mid n^2 \implies 2 \mid n\implies n = 2k \implies 3\cdot 2^m + 4 = 4k^2\quad(1)$$ Observe that $m = 1$ yields no integer solution, and $m = 2 \implies k = 2 \implies n = 4$.Thus consider $m \ge 3$, divide both sides of $(1)$  by $4$, you have: $3\cdot 2^{m-2}+1=k^2\implies k$ is odd $$\implies k = 2q+1\implies 3\cdot2^{m-2}+1=(2q+1)^2 \implies 3\cdot2^{m-2} = 4q(q+1)\quad(2)$$ Observe also that $m = 3,4$ yields no integer solution in $q$. So $m \ge 5$, and $(2)$ gives $$3\cdot 2^{m-4} = q(q+1)$$ $$\implies q =2, q+1 = 3 \implies q =2^{m-4}$$ $$\implies q =3, q+1 = 4 =2^{m-4}$$ $$\implies m =5\implies k = 5\implies n = 10 \implies (m,n) = (5,10)$$ $$\implies m =6\implies k = 7\implies n = 14 \implies (m,n) = (6,14)$$ are the remaining solutions. So altogether, the solutions are: $(2,4), (5,10), (6,14)$ are the $3$ solutions and they are the only solutions to the equation.
</s>