Number of Integer Solutions to $k^2-2016=3^n$ How many pairs of integers (k,n) satisfy the equation 
$k^2-2016=3^n$
The only thing I could think to do was factor out 3^2 from the entire equation to get
$(k/3)^2-224=3^{n-2}$
but that doesn't lead to anything useful. I know that (45, 2) is a solution, but that was from trial and error. Can you show me how to solve this or at least point me in the right direction? Thanks.
 A: After your simplification, observe that $\frac{k}{3}\equiv 0\text{ or }1$ (mod $3$) and $-224\equiv 1$ (mod $3$). So the right side cannot be divisible by $3$ which gives you $n-2=0$ from where you get $n=2$
A: Just consider $\mod 4$ and you know $n$ is even. $\mod 3$ you know $3\mid k$. So we are left with an equation 
$$x^2-224=3^{2y},$$ 
where $y\ge 0$. 
Then we want to solve 
$$(x+3^y)(x-3^y)=224,$$ which is doable. 
A: Note that $2016=224\times 9$ and $x^2\equiv 0,1 \pmod 4$. If $x^2\equiv 0 \pmod 4$, then $3^n\equiv 0 \pmod 4$, but this is impossible. So it must be $x^2\equiv 1 \pmod 4$. Since $3^{2r+1}\equiv 3 \pmod 4$ and $3^{2r}\equiv 1 \pmod 4$ we deduce that $n$ is even. So, let's say $n=2m$ with $m\ge 0$. On the other hand, since $x^2=2016+9^m$ we get that $3|x$, so we can write $x=3y$. 
Therefore we have the equation $9y^2-2016=9^m$, which is equivalent to $y^2-224=9^{m-1}$. If $m>1$, $9|9^{m-1}$ and thus $9|y^2-224$. Since $224\equiv -1 \pmod 9$, we get that $y^2\equiv -1\pmod 9$, but for $a\in \mathbb{Z}$ we have $a^2\equiv 0,1,4,7 \pmod 9$, so it's impossible to have $y^2\equiv -1 \pmod 9$. Then $m=1$ and so $n=2$. From this we get $k^2=2016+9=2025$, so $k=\pm 45$. 
Hence, all the integer solutions are the pairs $(k,n)=(45,2), (-45,2)$. 
