Find the sum of the following series: $$(1^2 - 1 + 1)(1!) + (2^2 - 2 + 1)(2!) + \cdots + (n^2 - n + 1)(n!) $$
I tried simplifying the $n^{th}$ term to use the method of telescoping to see if most of the terms get cancelled. But I couldn't simplify it in a way that was helpful. Any hints would be appreciated.
We have
$$\sum_{k=1}^n (k^2-k+1)k!=\sum_{k=1}^n [(k+1)^2-3k]k!=\sum_{k=1}^n (k+1)(k+1)!-\sum_{k=1}^n kk!-2\sum_{k=1}^n kk!=$$
$$=(n+1)(n+1)!-1-2\sum_{k=1}^n kk!$$
and
$$\sum_{k=1}^n kk!=\sum_{k=1}^n (k+1-1)k!=\sum_{k=1}^n (k+1)!-\sum_{k=1}^n k!=(n+1)!-1$$
therefore
$$\sum_{k=1}^n (k^2-k+1)k!=(n+1)(n+1)!-1-2((n+1)!-1)=(n-1)(n+1)!+1$$