A numerical evaluation of $\sum_{n=1}^{\infty}(-1)^{\frac{n(n+1)}{2}}\frac1{n!}\int_0^1x^{(n)} dx$

In fact this series admits a very nice closed form.

We have

$$\sum_{n=1}^{\infty}\frac{(-1)^{\frac{n(n+1)}{2}}}{n!}\int_0^1x(x+1)\cdots(x+n-1)\: dx=\color{blue}{\frac{8 \ln 2 }{\pi ^2+4 \ln^2 2}-1} \tag1$$

with the numerical evaluation

$$\begin{align} \color{blue}{-0.529727623071144825135721...} .\tag2 \end{align} $$

I've found the following result.

Theorem. Let $u$ be a complex number such that |u|<1. Then

$$\begin{align} &\sum_{n=1}^{\infty}\frac{(-1)^{\frac{n(n+1)}{2}}}{n!}\left(\int_0^1x(x+1)\cdots(x+n-1)\: dx\right)u^n\\\\ &=-1+\frac{(1+i)u}{2 (1+iu)\log(1+iu)}+\frac{(1-i)u}{2 (1-iu)\log(1-iu)}, \end{align} \tag3 $$

where $i^2=-1$.

Proof. Recall that $$ x(x+1)\cdots(x+n-1)=\sum_{k=0}^n {n\brack k}x^k \tag4 $$ where $\displaystyle {n\brack k}$ are the unsigned Stirling numbers of the first kind counting the numbers of permutations of $n$ letters that have exactly $k$ cycles, giving $$ \int_0^1 x(x+1)\cdots(x+n-1)\: dx =\sum_{k = 1 }^{n } \frac{\large {n \brack k}}{k+1}. \tag5 $$

Using $(5)$, we have proved that (see here, identity $(3)$) for $|u|<1$, $$ \sum_{n=1}^{\infty}\frac{(-1)^n}{n!}\left(\int_0^1x(x+1)\cdots(x+n-1)\: dx\right)u^n=-1+ \frac{u}{(1+u) \log(1+u)} \tag6 $$ and that (see here) $$ \frac{1}{n!} \int_0^1x(x+1)\cdots(x+n-1)\: dx = \mathcal{O} \left(\frac{1}{\ln n}\right), \quad \text{as} \quad n \rightarrow \infty. $$ Consequently, setting $\displaystyle a_n:= \int_0^1x(x+1)\cdots(x+n-1)\: dx$ for notational convenience, with $|u|<1$, we are allowed to write $$ \begin{align} \sum_{n=1}^{\infty}(-1)^{\frac{n(n+1)}{2}}\frac{a_n}{n!} u^n&=\sum_{p=1}^{\infty}(-1)^{p}\frac{a_{2p}}{(2p)!} u^{2p}+\sum_{p=1}^{\infty}(-1)^{p}\frac{a_{2p-1}}{(2p-1)!} u^{2p-1}\tag7\\\\ &=\frac12 \left(g(iu)+g(-iu)\right)-\frac i2 \left(g(iu)-g(-iu)\right) \tag8 \end{align} $$ where $g(\cdot)$ is the right hand side member of $(6)$. This gives $(3)$.

The series $$\sum_{n=1}^{\infty}(-1)^{\frac{n(n+1)}{2}}\frac{a_n}{n!} \tag9 $$ is convergent by the Dirichlet test, then we deduce $(1)$ from $(3)$ by Abel's theorem, using $$ -1+\frac{1}{2 \log(1-i)}+\frac{1}{2 \log(1+i)}=-1+\frac{8 \ln 2 }{\pi ^2+4 \ln^2 2}. $$


Sum the Integrands

We can use the identity $$ \frac{(1+i)i^n+(1-i)(-i)^n}2=(-1)^{\frac{n(n+1)}2}\tag{1} $$ to get $$ \begin{align} &\sum_{n=0}^\infty(-1)^{\frac{n(n+1)}2}\frac{x(x+1)\cdots(x+n-1)}{n!}\\ &=\sum_{n=0}^\infty\frac{(1+i)i^n+(1-i)(-i)^n}2\binom{n+x-1}{n}\tag{2a}\\ &=\sum_{n=0}^\infty\frac{(1+i)(-i)^n+(1-i)i^n}2\binom{-x}{n}\tag{2b}\\ &=\frac{1+i}2(1-i)^{-x}+\frac{1-i}2(1+i)^{-x}\tag{2c}\\ &=\frac{1+i}22^{-x/2}e^{i\pi x/4}+\frac{1-i}22^{-x/2}e^{-i\pi x/4}\tag{2d}\\[4pt] &=2^{-(x+1)/2}e^{i\pi(x+1)/4}+2^{-(x+1)/2}e^{-i\pi(x+1)/4}\tag{2e}\\[8pt] &=2^{-(x-1)/2}\cos(\pi(x+1)/4)\tag{2f}\\[8pt] &=2^{(1-x)/2}\sin(\pi(1-x)/4)\tag{2g} \end{align} $$ Explanation:
$\text{(2a)}$: apply $(1)$
$\text{(2b)}$: $\binom{-x}{n}=(-1)^n\binom{n+x-1}{n}$
$\text{(2c)}$: apply Binomial Theorem
$\text{(2d)}$: convert to polar form
$\text{(2e)}$: algebra
$\text{(2f)}$: convert to trig form
$\text{(2g)}$: $\cos(\pi(x+1)/4)=-\sin(\pi(x-1)/4)$


Integrate the Sum Note that we included the $n=0$ term, which is $1$, in $(2)$. We simply need to integrate $(2)$ over $[0,1]$ and subtract the contribution from the $n=0$ term, which is $1$. $$ \begin{align} &\int_0^12^{(1-x)/2}\sin(\pi(1-x)/4)\,\mathrm{d}x-1\\ &=\int_0^12^{x/2}\sin(\pi x/4)\,\mathrm{d}x-1\\ &=\mathrm{Im}\!\left(\int_0^1e^{(\log(2)/2+i\pi/4)x}\,\mathrm{d}x\right)-1\\ &=\mathrm{Im}\!\left(\frac{i}{\log(2)/2+i\pi/4}\right)-1\\ &=\bbox[5px,border:2px solid #C00000]{\frac{8\log(2)}{4\log(2)^2+\pi^2}-1}\\[3pt] &\doteq-0.52972762307114482514\tag{3} \end{align} $$ This agrees with Olivier Oloa's result.


Changing the Order

Using the log-convexity of $\Gamma(x)$ and the first few terms of the power series for $\Gamma(x)$ near $x=1$, it is shown in this answer that $$ \frac1{n!}\int_0^1\frac{\Gamma(x+n)}{\Gamma(x)}\,\mathrm{d}x \sim\frac1{\log(n)}-\frac\gamma{\log(n)^2}-\frac{\frac{\pi^2}6-\gamma^2}{\log(n)^3}+O\left(\frac1{\log(n)^4}\right)\tag{4} $$ This means that the terms in $$ \sum_{n=1}^\infty(-1)^{n(n+1)/2}\frac1{n!}\int_0^1\frac{\Gamma(x+n)}{\Gamma(x)}\mathrm{d}x\tag{5} $$ converge very slowly. Given this, it is reasonable to question the change of order between integration and summation.

However, we are allowed to change the order of a finite sum and integration, and therefore, we can consider the sum grouped into fours.

Since $(-1)^{n(n+1)/2}$, starting at $n=1$, follows the pattern $-1,-1,+1,+1,\dots$, and the absolute values of the terms are monotonically decreasing, the sum of each group of four terms is negative. Since the sum converges, it converges absolutely. Now we can apply Fubini's Theorem to allow us to switch the order of summation (integration on a discrete space) and integration.


You can expect the error in $S_n$ to be of the order of $a_{n+1}$. The problem is that the sequence $$ \frac1{n!}\int_0^1x(x+1)\cdots(x+n-1)\,dx $$ decreases very slowly. In fact $$ a_{2^{20}}=0.06865413726465990. $$ I have done calculations that suggest that $a_n$ decreases like $C/\log n$ for some constant $C$. This implies that to get an error of order $10^{-5}$ you need to sum $e^{10^5}$ terms.