Ta có: \(n^3-1⋮n+1\)
\(\Leftrightarrow n^3+n^2-n^2-n+n+1-2⋮n+1\)
\(\Leftrightarrow n^2\left(n+1\right)-n\left(n+1\right)+\left(n+1\right)-2⋮n+1\)
\(\Leftrightarrow\left(n+1\right)\left(n^2-n+1\right)-2⋮n+1\)
mà \(\left(n+1\right)\left(n^2-n+1\right)⋮n+1\)
nên \(-2⋮n+1\)
\(\Leftrightarrow n+1\inƯ\left(-2\right)\)
\(\Leftrightarrow n+1\in\left\{1;-1;2;-2\right\}\)
hay \(n\in\left\{0;-2;1;-3\right\}\)
Vậy: \(n\in\left\{0;-2;1;-3\right\}\)