<s>[INST] Complete square values of quadratic formula For Which values of $x \in [0,n]$ the polynomial $P(x)=ax^2+bx+c$ $\ $ gives a complete square value.
For instance the polynomial $P(x)=3x^2+5x+7$ on the interval $x \in [0,100]$ has only two values for $x=3  \rightarrow P(3)=49 $ and for $x=54  \rightarrow P(54)=9025 $.
I was wondering if there is a method to find such values of $x$ directly.
 [/INST] $y^2=3x^2+5x+7$.
$12y^2=36x^2+60x+84=(6x+5)^2+59$.
$u^2-3v^2=-59$ where $u=6x+5$, $v=2y$.
Given one solution of $u^2-3v^2=-59$, and a fundamental solution of $u^2-3v^2=1$, you can get infinitely many solutions of $u^2-3v^2=-59$, and from those infinitely many solutions of $y^2=3x^2+5x+7$.
Now a fundamental solution of $u^2-3v^2=1$ is $u=2$, $v=1$. A solution of $u^2-3v^2=-59$ is given by $u=4$, $v=5$. If you let $a_n+b_n\sqrt3=(2+\sqrt3)^n(4+5\sqrt3)$, $n=1,2,3,\dots$, then you'll get $a_n^2-3b_n^2=-59$. Then you can see which of those solutions yield integers for $x,y$.
</s>