\(\frac{n^2+2n+4}{n+1}=\frac{n\left(n+1\right)+n+4}{n+1}=\frac{n\left(n+1\right)}{n+1}+\frac{n+4}{n+1}=n+\frac{n+4}{n+1}\in Z\)
Suy ra \(n+4⋮n+1\)
\(\frac{n+4}{n+1}=\frac{n+1+3}{n+1}=\frac{n+1}{n+1}+\frac{3}{n+1}=1+\frac{3}{n+1}\in Z\)
Suy ra \(3⋮n+1\Rightarrow n+1\inƯ\left(3\right)=\left\{1;-1;3;-3\right\}\)
\(\Rightarrow n\in\left\{0;-2;2;-4\right\}\)