<s>[INST] Finding integer values of $n$ 
Finding integer values of $n$ for which the equation
  $$x^3+(n+1)x^2-(2n-1)x-(2n^2+n+4)=0$$
  has at least one integer solution.

Try: let $\alpha,\beta,\gamma$ be the roots of the equation. Then
$\alpha+\beta+\gamma=-(n+1)$ and $\alpha\beta+\beta\gamma+\gamma\alpha=1-2n$ and $\alpha\beta\gamma=2n^2+n+4$.
Now i did not understand how to solve it. Could some help me to solve it , Thanks
 [/INST] Suppose $x,n$ are integers such that
$$x^3+(n+1)x^2-(2n-1)x-(2n^2+n+4)=0\tag{eq1}$$

Suppose first that $n$ is odd.

Then, reducing mod $2$, we can replace $n$ by $1$, so
\begin{align*}
&x^3+(n+1)x^2-(2n-1)x-(2n^2+n+4)=0\\[4pt]
\implies\;&x^3+(n+1)x^2-(2n-1)x-(2n^2+n+4)=0\;(\text{mod}\;2)\\[4pt]
\implies\;&x^3-2x^2-x -7\equiv 0\;(\text{mod}\;2)\\[4pt]
\implies\;&x^3-x\equiv 1\;(\text{mod}\;2)\\[4pt]
\implies\;&0\equiv 1\;(\text{mod}\;2)\\[4pt]
\end{align*}
contradiction.

Hence $n$ must be even.

Then, reducing mod $2$, we can replace $n$ by $0$, so
\begin{align*}
&x^3+(n+1)x^2-(2n-1)x-(2n^2+n+4)=0\\[4pt]
\implies\;&x^3+x^2+x-4=0\;(\text{mod}\;2)\\[4pt]
\implies\;&x^3+x^2+x\equiv 0\;(\text{mod}\;2)\\[4pt]
\implies\;&x\equiv 0\;(\text{mod}\;2)\\[4pt]
\end{align*}
so $x$ must be even.

Writing $x=2w$, and $n=2m$, $(\text{eq}1)$ reduces to
$$4m^2 - (4w^2-4w-1)m -(4w^3+2w^2+w-2) = 0\tag{eq2}$$
Then, regarding $(\text{eq}2)$ as a quadratic equation in $m$, it follows that the discriminant
$$D = 16w^4+32w^3+40w^2+24w-31$$
is a perfect square.

Noting that $D$ is odd, $D$ must be an odd square

Identically, we have
$$
\begin{cases}
D = (4w^2+4w+3)^2 - 40\\[4pt]
D = (4w^2+4w+1)^2 + 16(w+2)(w-1)\\
\end{cases}
$$
hence we must have $-2 \le w \le 1$, else $D$ would be trapped strictly between 
$(4w^2+4w+1)^2$ and $(4w^2+4w+3)^2$, which are consecutive odd squares.

If $w=-1$ or $w=0$, then $D < 0$, contradiction.

For $w=-2$, $(\text{eq}2)$ reduces to $(4m-7)(m-4)=0$, which yields the solution $(w,m)=(-2,4)$ for $(\text{eq}2)$, and the corresponding solution $(x,n)=(-4,8)$ for  $(\text{eq}1)$.

For $w=1$, $(\text{eq}2)$ reduces to $(4m+5)(m-1)=0$, which yields the solution $(w,m)=(1,1)$ for $(\text{eq}2)$, and the corresponding solution $(x,n)=(2,2)$ for  $(\text{eq}1)$.

Thus, $n=2$ and $n=8$ are the only values of $n$ for which $(\text{eq}1)$ has at least one integer solution for $x$.
</s>