Number of possible integer values of $x$ for which $\frac{x^3+2x^2+9}{x^2+4x+5}$ is integer How many integer numbers, $x$, verify that the following
\begin{equation*}
\frac{x^3+2x^2+9}{x^2+4x+5}
\end{equation*}
is an integer?
I managed to do:
\begin{equation*}
\frac{x^3+2x^2+9}{x^2+4x+5} = x-2 + \frac{3x+19}{x^2+4x+5}
\end{equation*}
but I cannot go forward.
 A: You're off to a good start. Now note that the denominator $x^2+4x+5$ is quickly larger than the numerator $3x+19$; you can quickly reduce the problem to only finitely many values for $x$ to check.
More details: (Hover to show)

 The fraction is certainly not an integer if the denominator is greater than the numerator, i.e. if $$x^2+4x+5>3x+19,$$ unless perhaps the numerator is zero, but that is not possible in this case. The quadratic formula shows that the inequality above holds if $x\leq5$ or $x\geq4$. Then it remains to check whether the fraction is an integer for $x$ in the range $-4\leq x\leq3$.

A: Let $t=x+2$, then $$t^2+1\mid 3t+13$$ and thus $$t^2+1\mid t(3t+13)-3(t^2+1)= 13t-3$$
 so $$t^2+1\mid 13(3t+13)-3(13t-3) = 178$$
So $$t^2+1\in\{1,2,89,178\}\implies t=\pm 1,0 \implies x\in\{-1,-2,-3\}$$ 
A: Here is another method that works well when Diophantine quadratics $ax^2+bx+c=0$ are involved, it consists in saying that since a solution should exists then $\exists \delta\in\mathbb Z\mid b^2-4ac=\delta^2$.

In this problem we'd like $\quad\dfrac{3x+19}{x^2+4x+5}=n\quad$ to be an integer.
Thus applying the method to $$nx^2+(4n-3)x+(5n-19)=0$$

gives $\quad(4n-3)^2-4n(5n-19)=p^2\iff 4n^2-52n+(p^2-9)=0$

Which by itself should have solutions in $n$ : $\quad(-52)^2-4(4)(p^2-9)=q^2\iff 2848-16p^2=q^2$
We can divide by $16$ (setting $q=4r$) to get $$p^2+r^2=178$$
This has solutions $(\pm 3,\pm 13)$.



*

*case 1 : $p^2=3^2=9$
Leads to $4n^2-52n=0\iff 4n(n-13)=0\iff n=0,\ 13$
$n=0\implies 3x+19=0$ impossible
$n=13\implies 13x^2+49x+46=(x+2)(13x+23)=0$ and we verify that $x=-2$ is solution.



*

*case 2: $p^2=13^2=169$
Leads to $4n^2-52n+160=4(n-5)(n-8)=0\iff n=5,\ 8$
$n=5\implies 5x^2+17x+6=(x+3)(5x+2)=0$ and we verify that $x=-3$ is solution.
$n=8\implies 8x^2+29x+21=(x+1)(8x+21)=0$ and we verify that $x=-1$ is solution.

Finally we have found all solutions $x\in\{-3,-2,-1\}$
