Solving the recurrence relation $A_n=n!+\sum_{i=1}^n{n\choose i}A_{n-i}$ I am attempting to solve the recurrence relation $A_n=n!+\sum_{i=1}^n{n\choose i}A_{n-i}$ with the initial condition $A_0=1$. By "solving" I mean finding an efficient way of computing $A_n$ for general $n$ in complexity better than $O(n^2)$.
I tried using the identity $\dbinom{n+1}i=\dbinom{n}{i-1}+\dbinom{n}i$ but I still ended up with a sum over all previous $n$'s.
Another approach was to notice that $2A_n=n!+\sum_{i=0}^{n}{n \choose i}A_{n-i}$ and so if $a(x)$ is the EFG for $A_n$, then we get the relation $$2a(x)=\frac{1}{1-x}+a(x)e^x,$$ so $$a(x)=\frac{1}{(1-x)(2-e^x)}$$ (am I correct here?) but I can't see to to use this EGF for the more efficient computation of $A_n$.
 A: Since $(1-x)^{-1}=\sum\limits_{i=0}^{+\infty}x^i$ and $(2-\mathrm e^x)^{-1}=\sum\limits_{j=0}^{+\infty}2^{-j-1}\mathrm e^{jx}$, the number $A_n/n!$ is the $x^n$ term in
$$
\sum\limits_{i=0}^{+\infty}x^i\cdot\sum\limits_{j=0}^{+\infty}2^{-j-1}e^{jx}=\sum\limits_{i=0}^{+\infty}x^i\cdot\sum\limits_{j=0}^{+\infty}2^{-j-1}\sum\limits_{k=0}^{+\infty}\frac{j^k}{k!}x^k,
$$
that is
$$
A_n=n!\cdot\sum\limits_{j=0}^{+\infty}2^{-j-1}\sum\limits_{k=0}^{n}\frac{j^k}{k!}.
$$
Now, use two facts. First, for every $j$ and $k$,
$$
j^k=\sum\limits_{i=0}^{k}\left\{{k\atop i}\right\}\cdot(j)_i,
$$
where $\left\{{k\atop i}\right\}$ are Stirling's numbers of the second kind and $(j)_i$ is a Pochhammer symbol. Second,
use for the value $z=\frac12$ the general fact that, for every $|z|\lt1$,
$$
\sum\limits_{j=0}^{+\infty}(j)_i\cdot z^{j+1}=\frac{i!\cdot z^{i+1}}{(1-z)^{i+1}}.
$$
This yields finally $A_n$ as a finite double sum, namely,
$$
\color{red}{A_n=n!\cdot\sum\limits_{k=0}^{n}\frac1{k!}\sum\limits_{i=0}^{k}i!\cdot\left\{{k\atop i}\right\}=n!\cdot\left(1+\sum\limits_{k=1}^{n}\frac1{k!}\sum\limits_{i=1}^{k}i!\cdot\left\{{k\atop i}\right\}\right)}.
$$
Note: One tells me the numbers in the inner sums are called Fubini numbers or ordered Bell numbers.
A: You can certainly at least estimate $\frac{A_n}{n!}$ quite accurately and efficiently using the EGF by summing the contributions to the coefficients over enough of the poles of the generating function $a(z) = \frac{1}{(1 - z)(2 - e^z)}$. There are poles at $z = 1, \log 2 + 2 \pi i k, k \in \mathbb{Z}$; compute the residues at these poles and you get an expression for $\frac{A_n}{n!}$ as a sum of terms of the form $c_{\lambda} \lambda^n$ where $\lambda$ runs over the reciprocals of the poles. The $\lambda$ decrease rapidly. For more details see for example Flajolet and Sedgewick's Analytic Combinatorics.
I'm mildly curious what you need an exact value of $A_n$ for. If you know how to compute $n!$ efficiently (and I don't) you can use enough terms in the above sum that your error is better than $\frac{1}{n!}$, which shouldn't take too long. 
A: This isn’t an answer, but it may lead to useful references.
The form of the recurrnce suggests dividing through by $n!$ and substituting $B_n=\dfrac{A_n}{n!}$, after which the recurrence becomes $$B_n=1 + \sum_{i=1}^n\binom{n}i\frac{(n-i)!}{n!}B_{n-i}=1+\sum_{i=1}^n\frac{B_{n-i}}{i!}.$$
You didn’t specify an initial condition, so for the first few terms we have: 
$$\begin{align*}
B_0&=0+B_0\\
B_1&=1+B_0\\
B_2&=2+\frac32B_0\\
B_3&=\frac72+\frac{13}6B_0\\
B_4&=\frac{17}3+\frac{25}8B_0\\
B_5&=\frac{211}{24}+\frac{541}{120}B_0
\end{align*}$$
If we set $B_n=u_n+v_nB_0$, then $$u_n=1+\sum_{i=1}^n\frac{u_{n-i}}{i!}$$ with $u_0=0$, and $$v_n=\sum_{i=1}^n\frac{v_{n-i}}{i!}$$ with $v_0=1$. The ‘natural’ denominator of $u_n$ is $(n-1)!$, while that of $v_n$ is $n!$, so I looked at the sequences $$\langle (n-1)!u_n:n\in\mathbb{N}\rangle = \langle 0,1,2,7,34,211,\dots\rangle$$ and $$\langle n!v_n:n\in\mathbb{N}\rangle=\langle 1,1,3,13,75,541,\dots\rangle\;.$$ The first is OEIS A111539, and second appears to be OEIS A000670. There’s evidently a great deal known about the latter; there’s very little on the former.
Added: And with $A_0=1$ we have $B_0=1$ and $B_n=u_n+v_n$.
