# Find all value of integers n for which the expression is a perfect square.

Find all integers $n$ for which the expression $$n^4+6n^3+11n^2+3n+31$$ is a perfect square.

My approach :

First I simplified the expression and equated it to some square number $$(n^2+3n+1)^2 - 3(n-10) = k^2$$ Now if we try to remove the term "$3(n-10)$" then the equation will be satisfied. And it is done only be equating $n = 10$ . I don't know how to find other solution. Please help me in solving further.

Strategy: try to find two perfect squares such that the expression $f(n)=n^4+6n^3+11n^2+3n+31$ is strictly between them for all but finitely many $n$.
$(n^2+3n+1)^2$ is important to compute, as you also pointed out. It is $n^4+6n^3+11n^2+6n+1$.
So our impression is that $f(n)$ is close to this, and that if $f(n)$ is a perfect square, it should be the square of $n^2+3n+1$.
We prove this for all but finitely many $n$. More precisely, we prove that for all but finitely many $n$, we have $(n^2+3n)^2< f(n)< (n^2+3n+2)^2$. First part: $(n^2+3n)^2= n^4+6n^3+9n^2< n^4+6n^3+11n^2+3n+31 \Leftrightarrow 0< 2n^2+3n+31$. This holds for all $n\in \mathbb{Z}$ (the discriminant is negative). Second part: $n^4+6n^3+11n^2+3n+31< (n^2+3n+2)^2 = n^4 + 6n^3 +13n^2 + 12n + 4 \Leftrightarrow$ $0< 2n^2+9n-27$.
This inequality fails iff $-6\leq n\leq 2$. So unfortunately, you have to check if $f(n)$ is a perfect square for these nine values. (Easy calculation.) Once you are done with that, if $n$ is not among these nine values, then $f(n)$ is strictly between $(n^2+3n)^2$ and $(n^2+3n+2)^2$, so it has to be $(n^2+3n+1)^2$. This leads to a unary equation that you have already solved.