b) Ta có:
\(2n^2+n-7⋮n-2\)
\(\Rightarrow2n^2+\left(n-2\right)-5⋮n-2\)
\(\Rightarrow2n^2-5⋮n-2\)
\(\Rightarrow\left(2n^2-8\right)+3⋮n-2\)
\(\Rightarrow2\left(n^2-4\right)+3⋮n-2\)
\(\Rightarrow2\left(n-2\right)\left(n+2\right)+3⋮n-2\)
\(\Rightarrow n+2+3⋮n-2\)
\(\Rightarrow\left(n-2\right)+7⋮n-2\)
\(\Rightarrow7⋮n-2\)
\(\Rightarrow n-2\in\left\{-1;1;-7;7\right\}\)
\(\Rightarrow\left\{{}\begin{matrix}n-2=-1\Rightarrow n=1\\n-2=1\Rightarrow n=3\\n-2=-7\Rightarrow n=-5\\n-2=7\Rightarrow n=9\end{matrix}\right.\)
Vậy \(n\in\left\{1;3;-5;9\right\}\)