I'm trying to solve $y^2=3x^2+3x+1$ for integers, which transforms into $(2y)^2-3(2x+1)^2=1$. I know how to solve pell's equation, but how can we extract only (odd,even) pair from the solutions of the diophantine equation $y^2-3x^2=1$? Any help would be appreciated.



How to solve a quadratic diophantine equation
The fundamental solution is $2+\sqrt{3}.$ The general solution is $x\_n+\sqrt{3}y\_n=(2+\sqrt{3})^n,$ that is $$x\_n=\frac{(2+\sqrt{3})^n+(2-\sqrt{3})^n}{2}.$$ This is sequence A001075 at <https://oeis.org>. Writing it as a recurrence sequence we have $x\_0 = 1, x\_1 = 2, x\_n = 4x\_{n-1} - x\_{n-2}$. It follows that $x\_{2k+1}$ is even for all $k\geq 0.$ In your case
\begin{eqnarray\*}
2y&=&\frac{(2+\sqrt{3})^{2k+1}+(2-\sqrt{3})^{2k+1}}{2},\\
2x+1&=&\frac{(2+\sqrt{3})^{2k+1}-(2-\sqrt{3})^{2k+1}}{2\sqrt{3}}
\end{eqnarray\*}
provides all the solutions with $k\geq 0.$


