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+⋯+n=n(n+1)2

or

12+22+32+42+⋯+n2=n(n+1)(2n+1)6

Is there is any formula for:

1!+2!+3!+4!+⋯+n!

and

1!2+2!2+3!2+⋯+n!2?

Thanks in advance.

If not, is there any research on making this type of formula?

Because I am interested.

**Answer**

(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. One can, however, derive an integral representation that could probably be used as a starting point for analytic continuation. In particular, we have

\sum_{j=0}^{n-1}(j!)^2=2\int_0^\infty \frac{t^n-1}{t-1} K_0(2\sqrt t)\mathrm dt

where K_0(z) is the modified Bessel function of the second kind.

**Attribution***Source : Link , Question Author : vikiiii , Answer Author : J. M. ain’t a mathematician*