$(n-1,n^2+n+1)=(n-1,(n-1)^2+3(n-1)+3)=(n-1,3)$
$=\begin{cases}3~~~n{\equiv}1(mod3)\\1~~~n{\not\equiv}1(mod3)\end{cases}$
谢谢!
登录后才能进行此操作