Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I came across a question where I needed to find the sum of the factorials of the first $n$ numbers. So I was wondering if there is any generic formula for this?

Like there is a generic formula for the series:

$$ 1 + 2 + 3 + 4 + \cdots + n = \frac{n(n+1)}{2} $$


$$ 1^{2} + 2^{2} + 3^{2} + 4^{2} + \cdots + n^{2} = \frac{n(n+1)(2n + 1)}{6} $$

Is there is any formula for:

$$ 1! +2! +3! + 4! + \cdots + n! $$


$$ {1!}^2 +{2!}^2 +{3!}^2 + \cdots + {n!}^2 $$?

Thanks in advance.

If not, is there any research on making this type of formula? Because I am interested.

share|improve this question
I doubt there is such a formula. Note that the last digit of your sum is constant and equal to $1+2+6+4=3$. It would be hard to have a general formula which gives you the same last digit... (I think) –  Beni Bogosel Nov 2 '12 at 14:25
Mathematica says that: $$\sum_{n=1}^{N}{n!}=-1-(-1)¡-(-1)^{N}\cdot\Gamma{(2+N)}\cdot(-N-2)¡,$$ where $n¡$ is the subfactorial –  Shaktal Nov 2 '12 at 14:28
See also: mathworld.wolfram.com/FactorialSums.html –  leonbloy Jan 14 '13 at 12:26

2 Answers 2

(Too long for a comment)

I don't know if there's a simpler form, but the sum of factorials has certainly been well-studied. In the literature, it is referred to as either the left factorial (though this term is also used for the more common subfactorial) or the Kurepa function (after the Balkan mathematician Đuro Kurepa).

In particular, for $K(n)=\sum\limits_{j=0}^{n-1}j!$ (using the notation $K(n)$ after Kurepa), we have as an analytic continuation the integral representation

$$K(z)=\int_0^\infty \exp(-t)\frac{t^z-1}{t-1}\mathrm dt,\quad \Re z>0$$

and a further continuation to the left half-plane is possible from the functional equation $K(z)-K(z-1)=\Gamma(z)$

An expression in terms of "more usual" special functions, equivalent to the one in Shaktal's comment, is

$$K(z)=\frac1{e}\left(\Gamma(z+1) E_{z+1}(-1)+\mathrm{Ei}(1)+\pi i\right)$$

where $E_p(z)$ and $\mathrm{Ei}(z)$ are the exponential integrals.

The sum of squares of factorials does not seem to have a simple closed form, but the sequence is listed in the OEIS.

share|improve this answer

In addition to the special functions given by J.M., an asymptotic expansion can be computed $$ \begin{align} \sum_{k=0}^n k! &=n!\left(\frac11+\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}+O\left(\frac1{n^6}\right)\right)\\ &=\sqrt{2\pi n}\frac{n^n}{e^n}\left(1+\frac{13}{12n}+\frac{313}{288n^2}+\frac{108041}{51840n^3}+\frac{12857717}{2488320n^4}+O\left(\frac1{n^5}\right)\right) \end{align} $$ As with most asymptotic expansions, the series does not converge, and cannot be used to get an exact answer, but it gives a good approximation.

Edit: I forgot to give $$ \begin{align} \sum_{k=0}^nk!^2 &=n!^2\left(\frac11+\frac1{n^2}+\frac1{n^2(n-1)^2}+\frac1{n^2(n-1)^2(n-2)^2}+\dots\right)\\ &=n!^2\left(1+\frac1{n^2}+\frac1{n^4}+\frac2{n^5}+\frac4{n^6}+\frac{10}{n^7}+O\left(\frac1{n^8}\right)\right)\\ &=2\pi\frac{n^{2n+1}}{e^{2n}}\left(1+\frac1{6n}+\frac{73}{72n^2}+\frac{1049}{6480n^3}+\frac{157541}{155520n^4}+O\left(\frac1{n^5}\right)\right) \end{align} $$

share|improve this answer

protected by Community Apr 24 '14 at 15:32

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.