# How to calculate the following sums?

I would like to know of a way to evaluate the following two for arbitrary $n$.

$$\sum_{i=1}^ni!\,, \quad \sum_{i=1}^n \frac{n!}{i!}.$$

-

For the second sum: \begin{align} \sum_{i=1}^n\frac{n!}{i!} &=\sum_{i=1}^\infty\frac{n!}{i!}-\sum_{i=n+1}^\infty\frac{n!}{i!}\\ &=(e-1)n!-\sum_{i=n+1}^\infty\frac{n!}{i!}\\ &=\lfloor(e-1)n!\rfloor \end{align} Since \begin{align} \sum\limits_{i=n+1}^\infty\frac{n!}{i!} &=\frac1{n+1}+\frac1{(n+1)(n+2)}+\frac1{(n+1)(n+2)(n+3)}+\dots\\ &\le\frac1{n+1}+\frac1{(n+1)^2}+\frac1{(n+1)^3}+\dots\\ &=\frac1n \end{align}

We can get an asymptotic expansion for the first sum: \begin{align} \sum_{i=1}^ni! &=n!\left(1+\frac1n+\frac1{n(n-1)}+\frac1{n(n-1)(n-2)}+\dots\right)\\ &=n!\left(1+\frac1n+\frac1{n^2}+\frac2{n^3}+\frac5{n^4}+\frac{15}{n^5}+\dots\right) \end{align}

-
do you know a way that doesn't use an irrational constant?+1 btw –  Jorge Fernández Apr 23 at 19:25
@user4140: other than summing the finite sum, I don't know of a simpler formula for the first sum. –  robjohn Apr 23 at 19:39
@user4140: Given that the actual answer involves an irrational constant, I don't see how you can expect that. I mean, yes we could we avoid it somehow, but it's implicitly going to turn up in the answer. What is your goal / what are you trying to do? –  ShreevatsaR Apr 24 at 2:30

For the first one you can have the integal representation

$$\sum_{i=1}^{n} i! = \sum_{i=1}^{n} \Gamma(i+1) = \sum_{i=1}^{n} \int_{0}^{\infty}x^{i}e^{-x} dx =\int_{0}^{\infty} {\frac {{x}^{n+1}-x}{x-1}}e^{-x}dx$$

-

See http://mathworld.wolfram.com/FactorialSums.html for a rather complex formula for sum of factorials, albeit closed-form in terms of various functions.

-


$\ds{\large\mbox{Attempt}\ {\tt I}}$: ( User $\tt @user2566092$ publishes this link about the first sum ). \begin{align} \sum_{k = 1}^{n}k!&=-1 + \sum_{k = 0}^{n}\int_{0}^{\infty}t^{k}\expo{-t}\,\dd t =-1 + \int_{0}^{\infty}\sum_{k = 0}^{n}t^{k}\expo{-t}\,\dd t =-1 + \int_{0}^{\infty}{t^{n + 1} - 1 \over t - 1}\,\expo{-t}\,\dd t \end{align}

$\ds{\large\mbox{Attempt}\ {\tt II}}$: \begin{align} \sum_{k = 1}^{n}k!&= \sum_{k = 0}^{n - 1}\Gamma\pars{k + 2} =\sum_{k = 0}^{\infty}\bracks{\Gamma\pars{k + 2} - \Gamma\pars{k + n + 2}} \\[3mm]&=\color{#c00000}{% \int_{0}^{\infty}\bracks{\Gamma\pars{x + 2} - \Gamma\pars{x + n + 2}}\,\dd x + \half\,\bracks{\Gamma\pars{2} - \Gamma\pars{n + 2}}} \\[3mm]&\color{#c00000}{\phantom{=}\mbox{}-2\Im\int_{0}^{\infty} {\Gamma\pars{\ic x + 2} - \Gamma\pars{\ic x + n + 2} \over \expo{2\pi x} - 1}\,\dd x} \\[3mm]&= \int_{0}^{\infty}\bracks{\Gamma\pars{x + 2} - \Gamma\pars{x + n + 2}}\,\dd x + \half - \half\,\pars{n + 1}! \\[3mm]&\phantom{=}\mbox{}-2\Im\int_{0}^{\infty} {\Gamma\pars{\ic x + 2} - \Gamma\pars{\ic x + n + 2} \over \expo{2\pi x} - 1}\,\dd x \end{align} $\color{#c00000}{\mbox{where we used the}}$ Abel-Plana Formula.

User $\tt @robjohn$ already solved the second one.

-