limit of a sequence with Lagrange inversion formula?

In a recent question to the Pari/GP mailing lists, a user stated that the limit as $N\to\infty$ of

$$\sum_{n=1}^N\dfrac{n^ne^{-n}}{n!}-\dfrac{2\sqrt{N}}{\sqrt{2\pi}}$$ is equal to $-2/3$. This seems to be an application of Lagrange inversion and/or the expansion of Lambert's $W$ function around $-1/e$, but I have not been able to find a proof. I would be interested in such a proof.

• I'd say it is Stirling formula in a Cesaro mean – Pietro Majer Feb 11 '18 at 11:06
• I think $n!=\sqrt{2\pi n}n^n{e^{-n}\ }(1+1/12n+o(1/n))$ together with $\sum_{n=1}^N {1\over \sqrt{n}}=2\sqrt{N}(1+cn+o(1/n))$ should suffice – Pietro Majer Feb 11 '18 at 12:01
• Unfortunately not: Stirling tells us that the expression is equal to some constant $C$ plus an explicit asymptotic expansion in $1/\sqrt{N}$, but does not tell us the constant $C$ itself. This is always the case in Euler-MacLaurin type results. – Henri Cohen Feb 11 '18 at 13:32
• You can find an answer to this question in this article mathworld.wolfram.com/KnuthsSeries.html – Nemo Feb 11 '18 at 14:16
• @Peter Heinig In fact the sum in that link is different, although closely related, to the sum in the OP: instead of $-{2\sqrt{ N}\over \sqrt{2\pi}}$ it has $-\sum_{k=1}^N {1\over \sqrt{2\pi k}}=-{2\sqrt{ N}\over \sqrt{2\pi}} + C + o(1)$ (so they are hopefully both correct) – Pietro Majer Feb 11 '18 at 22:00

The first step is to construct the generating function of your sequence. From the Taylor expansion of the Lambert $W$ function at 0, one gets that $-W(-x)$ is the generating function of the sequence $N^{N-1}/N!$ and therefore by differentiation $$\frac{-W(-x)}{1+W(-x)}=\sum_{N\ge1}{\frac{N^N}{N!}x^N}.$$ Replacing $x$ by $x/e$ and multiplying by $1/(1-x)$ yields the desired generating function $$F(x):=\frac{-W(-x/e)}{(1-x)(1+W(-x/e))}= \sum_{N\ge1}{\left(\sum_{n=1}^N{\frac{n^ne^{-n}}{n!}}\right)x^N}.$$
From there, the result follows from an analysis at $x=1$. From the known expansion of $-W(-x)$ at $1/e$, one deduces $$F(x)=\frac{\sqrt{2}}{2(1-x)^{3/2}}-\frac{2}{3(1-x)}+O\left(\frac1{\sqrt{1-x}}\right),\quad x\rightarrow1.$$
Now singularity analysis (or Darboux's method) deduces the asymptotic expansion of your sequence as $$\frac{\sqrt{2 N}}{\sqrt{\pi}}-\frac23+O(1/\sqrt{N}).$$
With slightly more work along the same lines, one obtains a full asymptotic expansion beginning with $${\frac {\sqrt {2N}}{\sqrt {\pi}}}-\frac23+{\frac { \sqrt {2}}{3\sqrt {\pi N}}}-{\frac {37\sqrt {2}}{864\sqrt {\pi}N^{3/2}}}+{\frac {359\sqrt {2} }{64800\sqrt {\pi}N^{5/2}}}+O \left( {N}^{-7/2} \right) .$$