Simplify Double Summation with interdependencies

19 Views Asked by At

I'm trying to understand the worst-case time complexity of the kth permutation coding problem. That is, how do I simplify the following:

$$ \sum_{l=1}^{n} \sum_{i=0}^{n-l} 2l+m $$

to

$$ \frac{1}{6}n(n+1)(3m+2n+4) $$