# Strange symmetry regarding sum $\sum_{n=0}^\infty\frac{n^ne^{-bn}}{\Gamma(n+1)}$ and integral $\int_{0}^\infty\frac{x^xe^{-bx}}{\Gamma(x+1)}dx$

One can show by computation the following for $b>1$ $$\sum_{n=0}^\infty\frac{n^ne^{-b n}}{\Gamma(n+1)}=\frac{1}{1+W_{\color{blue}{0}}(-e^{-b})},\tag{1}$$ (here one assumes that the term with $n=0$ is understood as the limit $\lim_{n\to 0}$ and is equal to $1$) and $$\int_{0}^\infty\frac{x^xe^{-b x}}{\Gamma(x+1)}dx=\boldsymbol{\color{red}{-}}\frac{1}{1+W_{\color{red}{-1}}(-e^{-b})}.\tag{2}$$

$W_0$ and $W_{-1}$ are different branches of the Lambert W function. One can see that this formulas look similar. I considered them in the hope of obtaining a function for which sum equals integral: $$\sum_{n=0}^\infty f(n)=\int_0^\infty f(x) dx.$$ $(1)$ is the consequence of Lagrange inversion and the integral arises in the probability distribution theory, namely the Kadell-Ressel pdf (see also this MSE post).

Question 1. Can anybody explain the symmetry between $(1)$ and $(2)$ without resorting to direct calculation?

Question 2. Is it possible to alter $(1)$ and $(2)$ to obtain a nice function for which sum equals integral?

If $b=1$ then there is the Knuth series $$\sum_{n=1}^\infty\left(\frac{n^ne^{-n}}{\Gamma(n+1)}-\frac1{\sqrt{2\pi n}}\right)=-\frac23-\frac1{\sqrt{2\pi}}\zeta(1/2),\tag{3}$$ and the "Knuth integral" $$\int_0^\infty\left(\frac{x^xe^{-x}}{\Gamma(x+1)}-\frac1{\sqrt{2\pi x}}\right)dx=-\frac13.\tag{4}$$ Again we see there is a discrepancy.

Question 3. Is it possible to modify the term $\frac1{\sqrt{2\pi x}}$ in $(3)$ and $(4)$ so that the series and the integral agree?

Edit. Of course by mounting some additional terms and parameters one can come up with a formula that technically answers question 2 or 3. What is meant as nice in question 2 might be difficult to formulate explicitly. It is best illustrated by formulas in this MSE post.

• Doesn't the Euler-McLaurin formula implies that sums cannot equal integrals exactly, when the sumand is identical to the integrand? – Alecos Papadopoulos Oct 18 '17 at 17:22
• @AlecosPapadopoulos, there are a lot of examples demonstrating that the difference can vanish. – Nemo Oct 18 '17 at 17:24
• @Nemo would you mind to provide some examples or even a resource? maybe someone can spot a pattern – tired Oct 18 '17 at 19:45
• @Nemo Great initiative, but something's wrong with the link. Can you clearly separate the link from surrounding text? Thanks! – Alecos Papadopoulos Oct 18 '17 at 20:20
• Your post shows an interest in "a function for which sum equals integral." But this cannot be what you mean; you must mean you are looking for a continuous (or even nicer) function having that properly. Otherwise there are trivial examples (which I know you know): $f(x)=2^{-x}$ when $x$ is a positive integer, say, and zero otherwise. – symplectomorphic Oct 19 '17 at 6:18

Question 2. Is it possible to alter (1) and (2) to obtain a function for which sum equals integral?

A simpler form for $z\in[0,\mathrm{e}^{-1})$:

\begin{align} \sum_{n=0}^\infty \frac{(z\,n)^n}{\Gamma(n+1)} &= \frac1{1+\operatorname{W}_{0}(-z)} \tag{1}\label{1} ,\\ \int_0^\infty \frac{(z\,x)^x}{\Gamma(x+1)}\,dx &=-\frac1{1+\operatorname{W}_{-1}(-z)} \tag{2}\label{2} . \end{align}

For some $u\in\mathbb{R}$ consider \begin{align} \sum_{n=0}^\infty \frac{u}{(n+1)^2} &=\frac{u\pi^2}6 \tag{3}\label{3} ,\\ \int_0^\infty \frac{u}{(x+1)^2}\,dx&=u \tag{4}\label{4} . \end{align}

Let's add \eqref{3} and \eqref{4} to \eqref{1} and \eqref{2}, respectively:

\begin{align} \sum_{n=0}^\infty \left( \frac{(z\,n)^n}{\Gamma(n+1)} +\frac{u}{(n+1)^2} \right) &= \frac1{1+\operatorname{W}_{0}(-z)} +\frac{u\pi^2}6 \tag{5}\label{5} ,\\ \int_0^\infty \left( \frac{(z\,x)^x}{\Gamma(x+1)} +\frac{u}{(x+1)^2} \right) \,dx &=-\frac1{1+\operatorname{W}_{-1}(-z)} +u \tag{6}\label{6} . \end{align}

From the right hand sides of \eqref{5} and \eqref{6} for any $z\in[0,\mathrm{e}^{-1})$ we have

\begin{align} u&= -6\frac{2+\operatorname{W_0}(-z)+\operatorname{W_{-1}}(-z)}{(\pi^2-6)(1+\operatorname{W_0}(-z))(1+\operatorname{W_{-1}}(-z))} \end{align}

such that the pair $(z,u)$ satisfies \eqref{5}=\eqref{6}.

For example,

\begin{align} z&=\tfrac12\ln2 ,\quad\operatorname{W_0(-z)}=-\ln2,\quad\operatorname{W_{-1}(-z)}=-2\ln2 ,\\ &\sum_{n=0}^\infty \left( \frac{(n\ln2)^n}{2^n\Gamma(n+1)} - \frac{6(2-3\ln2)}{ (\pi^2-6)(1-\ln2)(1-2\ln2)(n+1)^2 } \right) \\ =& \int_{0}^\infty \left( \frac{(x\ln2)^x}{2^x\Gamma(x+1)} - \frac{6(2-3\ln2)}{ (\pi^2-6)(1-\ln2)(1-2\ln2)(x+1)^2 } \right) \\ =& \frac{\pi^2(\ln2-1)+6(2\ln2-1)}{ (\pi^2-6)(\ln2-1)(2\ln2-1) } \approx 1.549536 . \end{align}

Edit

Similarly,

\begin{align} &\sum_{n=0}^\infty 2^{-n} \left( \frac{(n\ln2)^n}{\Gamma(n+1)} + \frac{\ln2\,(3\ln2-2)}{ (\ln2-1)(2\ln2-1)^2 } \right) \\ =& \int_{0}^\infty 2^{-x} \left( \frac{(x\ln2)^x}{\Gamma(x+1)} + \frac{\ln2\,(3\ln2-2)}{ (\ln2-1)(2\ln2-1)^2 } \right) \\ =& \frac{2(\ln2)^2-1}{ (\ln2-1) (2\ln2-1)^2 } \approx 0.8537740 . \end{align}

• Apologies for not clarifying the question earlier. – Nemo Oct 19 '17 at 6:52