Ta có:\(n^2+n+2=n\left(n+1\right)+2\)
+)Xét n chia hết cho 3 <=> n=3k \(\left(k\in Z+\right)\)
=>\(n^2+n+2=3k\left(3k+1\right)+2\) chia 3 dư 2 (1)
+)Xét n chia 3 dư 1 <=> n=3k+1
=>\(n^2+n+2=\left(3k+1\right)\left(3k+2\right)+2=9k^2+6k+3k+2+2\)
\(=3\left(3k^2+2k+k+1\right)+1\)chia cho 3 dư 1 (2)
+)Xét n chia 3 dư 2 <=> n=3k+2
=>\(n^2+n+2=\left(3k+2\right)\left(3k+3\right)+2=9k^2+9k+6k+6+2\)
\(=3\left(3k^2+3k+2k+2\right)+2\)chia 3 dư 2 (3)
Từ (1), (2), (3) suy ra n2+n+2 không chia hết cho 3 với \(n\in Z+\)