How to solve $p^{2a+1}+p^a+1=b^2$ in integers? For prime number $p$ and positive integers $a$ and $b$ solve the following equation 
$$p^{2a+1}+p^a+1=b^2$$
Can you give me a hint for starting this problem?
 A: Hint
$$p^a(p^{a+1}+1)=b^2-1=(b-1)(b+1)$$
Hint 2 $gcd(b-1,b+1)=1$ or $2$. If $p \neq 2$ then $p^a$ must divide either $b-1$ or $b+1$.
Hint 3 
If $b+1=kp^{a}$ then $b-1=\frac{p^{a+1}+1}{k}$. Then 
$$kp^a-\frac{p^{a+1}+1}{k}=2 \\
k^2p^a-p^{a+1}-1=2k \\ 
k^2p^a-p^{a+1}=2k+1 \\ 
$$
This means that $p |2k+1$. 
Also, $b+1=kp^{a}$ and $b-1=\frac{p^{a+1}+1}{k}$ imply that $1 < k<p$.
There is only one possibility.
The case $b-1=kp^{a}$ then $b+1=\frac{p^{a+1}+1}{k}$, is almost identic, you just get a sign changed.
Lats, the case $p=2$ is easy to tackle separately.
A: It is worth noting that for $p=2$ this becomes the IMO 2006 problem 4. For $p \neq 2$ we have $b=p^ac+d$ for positive even integer $c$, where $d= \pm 1$ and $\gcd(p, c)=1$. Putting this in the equation gives $$p^{2a+1}+p^a+1=p^{2a}c^2+2p^a cd+1$$and $$p^{a+1}+1=p^a c^2+2cd \Longrightarrow p^a(p-c^2)=2cd-1$$ Now work on cases $d= \pm 1$.
The original problem (IMO 2006 problem 4) has a good generalization that you might want to try it: $$2^{2a+1}+2^a+1=b^c$$ 
