Find the value of n if: $$\sum_{k=0}^n (k^{2}+k+1) k! = (2007).2007!$$
How to approach this problem? In need of ideas. Thank you.

Note that
$$
\begin{align}
(n+1)(n+1)!-n\,n!
&=\left((n+1)^2-n\right)n!\\
&=\left(n^2+n+1\right)n!
\end{align}
$$
Therefore,
$$
\begin{align}
\sum_{n=0}^{2006}\left(n^2+n+1\right)n!
&=\sum_{n=0}^{2006}\left((n+1)(n+1)!-n\,n!\right)\\
&=\sum_{n=1}^{2007}n\,n!-\sum_{n=0}^{2006}n\,n!\\[9pt]
&=2007\cdot2007!-0\cdot0!
\end{align}
$$
