<s>[INST] Find all positive integers $x$ such that $x(x+2021)$ is a perfect square I completed the square as to get $(x+1010.5)^2-102110.25 = k^2$ but I don't know where to go from here.
Please help, thank you
I then got $(2x+2021)^2-4084441=4k^2$ then $(2k-2x-2021)(2k+2x+2021)=43^2*47^2$
 [/INST] Start from $$x (x+2021)=y^2$$
multiply both sides by $4$ and add $2021^2$ to both sides
$$4 x^2+8084 x+2021^2=4 y^2+2021^2\to (2x+2021)^2=4y^2+2021^2$$
set $2x+2021=z$ and remember that $2021^2=43^2\times 47^2$. The equation becomes
$$z^2-4y^2=43^2\times 47^2\to (z+2y)(z-2y)=43^2\times 47^2$$
we get the following possibilities
$$
\begin{array}{ll}
& \begin{cases}
z-2 y=1\\
2 y+z=2021^2\\
\end{cases}\to (y= 1021110,z= 2042221)\to x=1020100\\
&\begin{cases}
z-2 y=43\\
2 y+z=43\times 47^2\\
\end{cases}\to (y= 23736,z= 47515)\to x=22747\\
& \begin{cases}
z-2 y=47\\
2 y+z=43^2\times 47\\
\end{cases}\to (y= 21714,z= 43475)\to x=20727\\
& \begin{cases}
z-2 y=43^2\\
2 y+z= 47^2\\
\end{cases}\to (y= 90,z=  2029)\to x=4\\
\end{array}
$$
The values are only four:
$$x=4,20727,22747,1020100$$
</s>