<s>[INST] Integral value of $n$ that makes $n^2+n+1$ a perfect square. Find all integers $n$ for which $n^2+n+1$ is a perfect square.
By hit and trial we get $n=-1,0$ but could someone suggest any genuine approach as how to approach this problem?
 [/INST] As other solutions stated , one of your values can be obtained as like ,
$ n^2+n+1=k^2 \equiv 1 (mod 3) \implies n(n+1)\equiv 0 (mod 3)$
So $3|n$ or $3| (n+1)$ , put $n=3k$ , $f(k)=9k^2+3k+1=(3k+1)^2 - 3k$ which implies $n=k=0$ .
Secondly if $3|(n+1)$ put $n=3k-1$ & we get $ f(k)=9k^2-3k+1=(3k-1)^2+3k$ which forces $k=0$ & thus $n=3.0-1=-1$
We have $n^2<n^2+n+1<(n+1)^2$ and $n^2+n+1$ is perfect square for $n=0,-1$ .
</s>