Consider the following Diophantine equation $$x^2 + xy + y^2 = n\,.$$ For a particular positive integer $n$, the number of solutions $\left(x,y\right)$ such that $x$ and $y$ are integers is given by the function $S(n)$.
The function $S(n)$ is not one-to-one. For example, each number $n$ in the set $$\{1, 4, 9, 16, 25, 36\}$$ corresponds with $S(n) = 6$.
In increasing order, starting from $n = 1$, the first $n$ such that $S(n) = 36$ is $637$.
What is the $500$th $n$ such that $S(n) = 36$?
Any precise approach or hint from where I should start the problem?