\(n^2-2n+7=\left(n^2-n\right)-\left(n-1\right)+6=n\left(n-1\right)-\left(n-1\right)+6\)
\(=\left(n-1\right)\left(n-1\right)+6=\left(n-1\right)^2+6\)
Vì \(\left(n-1\right)^2⋮n-1\)\(\Rightarrow\)Để \(n^2-2n+7⋮n-1\)thì \(6⋮n-1\)
\(\Rightarrow n-1\inƯ\left(6\right)=\left\{\pm1;\pm2;\pm3;\pm6\right\}\)
\(\Rightarrow n\in\left\{-5;-2;-1;0;2;3;4;7\right\}\)
Vậy \(x\in\left\{-5;-2;-1;0;2;3;4;7\right\}\)