\(n^2+n+6\)là số chính phương nên \(n^2+n+6=a^2\)
\(\Leftrightarrow4n^2+4n+24=4a^2\)
\(\Leftrightarrow\left(2n\right)^2+2.2n+1+23=\left(2a\right)^2\)
\(\Leftrightarrow\left(2n+1\right)^2+23=\left(2a\right)^2\)
\(\Leftrightarrow\left(2a\right)^2-\left(2n+1\right)^2=23\)
\(\Leftrightarrow\left(2a+2n+1\right)\left(2a-2n-1\right)=23\)
Mà \(a,n\inℕ\)và \(\left(2a+2n+1\right)>\left(2a-2n-1\right)\)nên
\(\hept{\begin{cases}2a+2n+1=23\\2a-2n-1=1\end{cases}}\Leftrightarrow\hept{\begin{cases}2a+2n=22\\2a-2n=2\end{cases}}\)
\(\Leftrightarrow\hept{\begin{cases}a+n=11\\a-n=1\end{cases}}\Leftrightarrow\hept{\begin{cases}a=6\\n=5\end{cases}}\)
Vậy n = 5