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?

• I'd be good if you include what have you tried or how did you come up to this equation. Otherwise it might get closed. – Xam May 30 '17 at 19:15

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.

• Oh, this is good but little! I think I need to change my question :)) – user450041 May 30 '17 at 19:14
• Isnt this step easier than the rest? – Jorge Fernández Hidalgo May 30 '17 at 19:15
• @JorgeFernándezHidalgo To me the next step looks more obvious, it is standard when dealing with such equations. Added it though. – N. S. May 30 '17 at 19:18
• ok, I still have no idea how to finish from there – Jorge Fernández Hidalgo May 30 '17 at 19:18
• @N.S. thank you! then $b-1=p^a c$ or $b+1=p^a c$. Let me work on these cases! – user450041 May 30 '17 at 19:22

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$$