Sum of n + n(n-1) + n(n-1)(n-2) + ... + n!

133 Views Asked by At

This is to work out the time complexity of a computer science problem (write an algorithm to calculate the permutations of an array of n distinct integers).

Various answers on leetcode say the sum tends towards n*n! , but none of the proofs seem very well explained, so reaching out to the maths overlords.

1

There are 1 best solutions below

0
On BEST ANSWER

@JMoravitz answered the question in the comments section:

Add 1 and factor out ! from every term. Rearrange the sum from back-to-front. You have the sum is $!(\frac{1}{1!}+\frac{1}{2!}+\frac{1}{3!}+\frac{1}{4!}+\frac{1}{5!}+ ⋯ +\frac{1}{!})$ This sum inside the parentheses you should recognize as being related to .