1 answer

There is no closed formula for the given sum
$$ \sum_{1\le k\le n} k^2\cdot k!\ . $$
(At least i cannot see any at the first glance.) As in the comment i committed some seconds in advance, the implemented algorithm works for
$$ \sum_{1\le k\le n} P(k)\cdot k!\ . $$
iff the polynomial $P$ that appears is in the linear span of the polynomials: