\(\frac{n^2+n+17}{n+1}=\frac{n\left(n+1\right)+17}{n+1}=\frac{n\left(n+1\right)}{n+1}+\frac{17}{n+1}=n+\frac{17}{n+1}\in Z\)
\(\Rightarrow17⋮n+1\Rightarrow n+1\inƯ\left(17\right)=\left\{1;-1;17;-17\right\}\)
\(\Rightarrow n\in\left\{0;-2;16;-18\right\}\)