TITLE: Find all integers $(x, y)$ such that $1 + 2^x + 2^{2x + 1} = y^2$
QUESTION [5 upvotes]: Find all integers $$(x, y)$$ such that $$1 + 2^x + 2^{2x + 1} = y^2$$
So I basically used $$ f(x) = 1 + 2^x + 2^{2x + 1} = y^2$$ and created a table from 0 to 20. I got two pairs of integers: $$(0, \pm2)$$ and $$(4, \pm23)$$
I want to know if there's another method or if there are any other pairs of integers, or a generalisation.

REPLY [4 votes]: $1 + 2^x + 2^{2x + 1} = y^2 \\\implies 2^x(2^{x+1}+1) = (y+1)(y-1)$
$x<-1$ gives a non-integer LHS (no solutions)
$x=-1$ gives LHS $= 1$ with no solutions for $y$
$x=0$ gives LHS $= 3$ and $y=\pm 2$
For $x>0$,  $y$ is odd so put $y=2k+1$ and $2^x(2^{x+1}+1) = (2k+2)(2k) = 4k(k+1)$ which is divisible by $8$ so $x\ge 3$ and $2^{x-2}(2^{x+1}+1) = k(k+1)$. 
Clearly we cannot have $k=2^{x-2}$ or $k+1=2^{x-2}$ so we need $(2^{x+1}+1)$ to split into (odd) factors $r,s$ such that $2^{x-2}r = s\pm 1$. 
Then $|r|<8$ otherwise $2^{x-2}|r| > (2^{x+1}+1)$. Also $2^{x-2}r^2 = sr\pm r$ so $|r|=3$ is the only viable choice and $2^{x-2}9 = (2^{x+1}+1) \pm 3$ gives $2^{x-2} = 4$ i.e. $x=4$ (and $y=\pm 23$) as the only other solution.
In summary: the only solutions $(x,y)$ are $(0,\pm 2)$ and $(4,\pm 23)$, those you found.