Finding out the number of values of $n$ and $x$ such that $x^2+615=2^n$ The question is to find out the number of values of $x \in \mathbb Z $ and $n \in \mathbb N$ satisfying the equation $$x^2+615=2^n$$
I know that the number of values of $x$ will be twice the number of values of $n$. I tried to plot a curve but could not proceed. Any help would be highly appreciated. Thanks. 
 A: I agree with the solution above. Now, I explain (1) why $x^2$ can only take $0$ or $1$, and (2) why $n$ must be even:


*

*If $\forall x \in \mathbb N, x^2 \pmod{3} \equiv 2$. We assume $$x \in \{3k, 3k+1, 3k+2\}, k \in \mathbb N$$, and we also set $$x^2 = 3y+2,y \in \mathbb N$$ So we can judge three conditions: 


*

*${(3k)}^2 = 3y+2$, for $\forall y \in \mathbb N$, there doesn't exist such $k$ satisfied.

*${(3k+1)}^2 = 3y+2$, for $\forall y \in \mathbb N$, there doesn't exist such $k$ satisfied.

*${(3k+2)}^2 = 3y+2$, for $\forall y \in \mathbb N$, there doesn't exist such $k$ satisfied.



So, $x^2 \pmod{3} \neq 2$.


*If $2^n \pmod{3} = 2$, then $n$ is odd. We assume $$n=2k+1, k \in \mathbb N$$$$2^n = 2^{2k+1} = 3y+2, y\in \mathbb N$$ We can use induction to prove that:


*

*when $k=0$, $2^{2k+1} \pmod{3} = 2$

*when $k' = k+1$,then $$2^{2k'+1} = 2^{2(k+1)+1} = 2^{2k+1} \cdot 4 = (3y+2) \cdot 4 = 12y+8$$, so $2^{2k'+1} \pmod{3} = 2$

*if $n$ is even, we assume $n=2k,k \in \mathbb N$, then $$2^n = 2^{2k} = {(2^k)}^2$$. According to solution 1, we can conclude ${(2^k)}^2 \pmod{3} \neq 2 $


A: Ok, so start by assuming $x\geq 0$ (since if $x$ satisfies the equation, so does $-x$ and vice versa, hence we can assume this without any loss of generality) observing that $615=3\times5\times 41$. Now, explore the equation
$$
x^2 + 3\times5\times41 = 2^n
$$
in modulo 3. We have,
$$
x^2 \equiv 2^n \pmod{3},
$$
and since $x^2$ can only take $0$ or $1$ modulo 3, we must have that $n$ is even. Writing $n =2k$ and expanding, we arrive at
$$
(2^k-x)(2^k+x) = 615.
$$
The only possibility here is $2^k-x=5$ and $2^k+x = 123$ (you just need to try the cases $2^k-x = 1,3,5,15$ as $2^k-x < 2^k+x$), which gives us $k=6$ and $x=59$. Hence, $(59,12)$ and $(-59,12)$ are the only solutions to the given equation.
A: TBTD's answer can be improved by testing the equation modulo $7$, which assesses $n$ modulo $3$ because $2^3\equiv1$. Thus
$x^2-1\equiv2^n,$
from which (with $2$ being a quadratic residue) $x^2$ and $2^n$ must be quadratic residues differing by one. The available residues are $0,1,2,4$ and $2^n$ cannot be a multiple of $7$, so $x^2\equiv2$ and $2^n\equiv1$. It follows that $n$ is not only even as described by TBTD, but also a multiple of $3$ and therefore a multiple of $6$.
Then $n=6$ is too small, as $2^6<615$. At the same time $n=18$ is too large: $2^n$ (with $n$ even) and $x^2$ are squares differing by $615$ and the larger of these cannot exceed
$[(615+1)/2]^2=308^2<512^2=2^{18}.$
So $n=12$ is the only surviving candidate, and directly substituting this value gives $x^2=3481,\therefore x=\pm59$.
