I saw in this question that $$ \int {x^n e^x dx} = \bigg[\sum\limits_{k = 0}^n {( - 1)^{n - k} \frac{{n!}}{{k!}}x^k } \bigg]e^x + C. $$
and I was wondering if we can get some formula like that for
$$ \int {x^n e^{-x} dx} $$
when $n \in \mathbb N$. I already know that $$ \int^{\infty}_0 {x^n e^{-x} dx} = \Gamma(n+1) $$
but I'm looking for a general formula.
The general formula is simply $n\to z$ in which $z\in\mathbb{R}$:
$$\int_0^{+\infty}\ t^{z-1}e^{-t}\ \text{d}t = \Gamma(z)$$
Possibly avoid the poles: $z = 0, -1, -2, \ldots$.
If you are talking about a general formula for the indefinite integral, then the series expansion is what you are searching for.
Just expand the exponential in series
$$e^{-x} = \sum_{k = 0}^{+\infty}\frac{(-x)^k}{k!}$$
and you'll get the result:
$$\int x^n e^{-x}\ \text{d}x = \sum_{k = 0}^{+\infty} \frac{(-1)^k}{k!}\int x^{n+k}\ \text{d}x$$
Which is
$$\sum_{k = 0}^{+\infty}\frac{(-1)^k}{k!} \frac{1}{n+k+1}x^{n+k+1}$$