Sum of two consecutive squares equals difference of two consecutive cubes

There is the following sequence of positive solutions (according to Mathematica): $a_n=\frac{1}{8} \left(\left(\sqrt{6}-2\right) \left(2 \sqrt{6}+5\right)^n-\left(\sqrt{6}+2\right) \left(5-2 \sqrt{6}\right)^n-4\right),$ and $b_n=\frac{1}{12} \left(-\left(\sqrt{6}-3\right) \left(2 \sqrt{6}+5\right)^n+\left(\sqrt{6}+3\right) \left(5-2 \sqrt{6}\right)^n-6\right)$.

Your Diophantine equation is known as the Pell equation.


You can diagonalise the equation $2a(a+1)=3b(b+1)$ by writing it as $$2(2a+1)^2+1=3(2b+1)^2.$$

To parametrise all rational solutions of $2a(a+1)=3b(b+1)$ you can now homogenise $$2(2a+1)^2+1=3(2b+1)^2$$ into $$2(2a+1)^2+c^2=3(2b+1)^2$$ and define $$x:=2a+1,y:=c,z:=2b+1,$$ so that $$2(2a+1)^2+c^2=3(2b+1)^2$$ becomes $$2x^2+y^2-3z^2=0.$$ This is a diagonal conic with the rational point $(x_0,y_0,z_0)=(1,1,1)$ and you can find the parametrisation of all solutions before Theorem 2.3 these notes.

If you are only interested in the integer solutions of $2a(a+1)=3b(b+1)$ the you could try to do some arithmetic in the number field $\mathbb{Q}(\sqrt{-6})$ by noting that $$N_{\mathbb{Q}(\sqrt{-6})/\mathbb{Q}}(2(2a+1)+\sqrt{-6}(2b+1))=2((2a+1)^2-3(2b+1)^2)=2.$$


A better equation to solve in General.

$$aX^2+bX=cY^2+dY$$

As already mentioned, the task is reduced to some equivalent to the Pell equation. Actually reduced to this form.

$$p^2-acs^2=\pm1$$

Solution we write.

$$X=\pm{s(dp+cbs)}$$

$$Y=\pm{s(bp+ads)}$$

Or so.

$$X=\frac{\mp1}{a-c}((b-d)p^2-(2cb-(c+a)d)ps+c(cb-ad)s^2)$$

$$Y=\frac{\mp1}{a-c}((b-d)p^2-((a+c)b-2ad)ps+a(cb-ad)s^2)$$