# Why is this sum equal to the Logarithmic Integral?

I am using this sum:

$$\sum_{k=1}^\infty \frac{(-1)^{k-1}}{k}\left((-1)^{k-1} (n-1) + \sum_{j=1}^{k-1}\frac{(-1)^{j+k-1}n (\log n)^j}{j!}\right)$$

Empirically, this is precisely equal to

$$\sum_{k=1}^\infty \frac{(\log n)^k}{k! k}$$

which is the most significant term in this expansion of the logarithmic integral

$$\operatorname{li}(n) = \log \log n + \gamma + \sum_{k=1}^\infty \frac{(\log n)^k}{k! k}$$

where $\gamma$ is the Euler-Mascheroni constant.

Can anyone show why my sum is equal to the sum from the logarithmic integral?

-
Where you wrote $-1^{k-1}$, I am guessing you meant $(-1)^{k-1}$ and I changed it to that. – Michael Hardy Sep 12 '11 at 18:30
Note that when you write \log x rather than log x, then the backslash not only prevents "log" from being italicized, but it also provides proper spacing, so you don't need the spacing you did manually. – Michael Hardy Sep 12 '11 at 18:31
All of the $(-1)^{k-1}$ cancel out and there's only a $(-1)^j$ left in on the right numerator. – Henning Makholm Sep 12 '11 at 18:33
Michael - Thanks. I'm still getting used to Latex and MathJax. – Nathan McKenzie Sep 12 '11 at 19:39
Henning: True. The reason I kept the terms in its original, unnecessarily messy form, is that what I'm really trying to show is the relationship I've written up at icecreambreakfast.com/primecount/logintegral.html . Basically, it's a way of using Linnik's identity to connect the prime counting function to the logarithmic integral. I can get from the prime counting function up to the sum I just posted, but this last jump is stumping me. – Nathan McKenzie Sep 12 '11 at 19:40

I'll start the same way as Sasha, except that I'll first replace $n$ with $\exp\,z$:

$$\frac1{k}\left(-1+\exp\,z\sum_{j=0}^{k-1}\frac{(-z)^j}{j!}\right)$$

From here, we recall that the partial sums of the exponential function possess the following integral representation (see here for a proof):

$$\exp(-u)\sum_{j=0}^{k-1}\frac{u^j}{j!}=\frac1{(k-1)!}\int_u^\infty t^{k-1} \exp(-t)\mathrm dt$$

so we make the replacement:

$$-\frac1{k}+\frac1{k!}\int_{-z}^\infty t^{k-1} \exp(-t)\mathrm dt$$

Let's complicate things a bit:

$$-\frac{(k-1)!}{k!}+\frac1{k!}\int_{-z}^\infty t^{k-1} \exp(-t)\mathrm dt$$

and replace $(k-1)!=\Gamma(k)$ with its integral representation:

$$\frac1{k!}\left(-\int_0^\infty t^{k-1} \exp(-t)\mathrm dt+\int_{-z}^\infty t^{k-1} \exp(-t)\mathrm dt\right)$$

which simplifies:

$$\frac1{k!}\int_{-z}^0 t^{k-1} \exp(-t)\mathrm dt$$

We now treat the sum

$$\sum_{k=1}^\infty \frac1{k!}\int_{-z}^0 t^{k-1} \exp(-t)\mathrm dt$$

and swap summation and integration (justification left to the reader):

$$\int_{-z}^0\left(\sum_{k=1}^\infty \frac{t^{k-1}}{k!}\right)\exp(-t)\mathrm dt$$

which becomes

$$\int_{-z}^0\left(\frac{\exp\,t-1}{t}\right)\exp(-t)\mathrm dt=\int_{-z}^0\frac{1-\exp(-t)}{t}\mathrm dt=-\int_z^0\frac{1-\exp\,t}{-t}\mathrm dt=\int_0^z\frac{\exp\,t-1}{t}\mathrm dt$$

and since

$$\int_0^z\frac{\exp\,t-1}{t}\mathrm dt=\sum_{j=1}^\infty \frac{z^j}{j! j}$$

the claim is proven.

-
Wow. Thanks. Great to see that proven. – Nathan McKenzie Sep 13 '11 at 10:20
@Nathan: You're welcome. I haven't peered at how you implemented the computation of the logarithmic integral in your web page, but just in case: you might be interested in Ramanujan's series for the logarithmic integral (formula 15 here); I've found it slightly more efficient than the straightforward series for medium-sized arguments. – J. M. Sep 13 '11 at 10:23
The series I provided is even slower than Formula 14 from that page. Instead, its interest to me is from the following (this is my argument from my webpage - I'll try to go quick): If you have the strict divisor functions $d_1(n) = 1$ and $d_k(n) = \sum_{j | n, 1 < j < n}d_1(j)d_{k-1}(n/j)$, then Linnik's identity says $\sum_{k=1} (-1^{k+1})/k \cdot d_k(n) =$1/a if n = $p^a$ where p is a prime, 0 otherwise. Sum this from 2 to n, and you have $\sum_{j=2}^n 1 - 1/2\sum_{j=2}^n \sum_{k=2}^{n/j} 1+ 1/3\sum_{j=2}^n \sum_{k=2}^{n/j}\sum_{l=2}^{n/(jk)} 1 - ... = \Pi(n)$ – Nathan McKenzie Sep 13 '11 at 11:33
The term on the right is the prime power counting function. Approximate the sums on the left as $\int_{1}^n dx - 1/2\int_{1}^n \int_{1}^{n/x} dydx+ 1/3\int_{1}^n \int_{1}^{n/x}\int_{1}^{n/xy} dz dy dx - ...$, evaluate these integrals, and you immediately have the sums I asked about. I knew empirically that my integrals here were equal to $li(x) - \log \log x - \gamma$, but... – Nathan McKenzie Sep 13 '11 at 11:33
I see, @Nathan. I do have to agree that those are cute-looking multiple integrals... :) – J. M. Sep 13 '11 at 11:40

First of all note that the term being added to the inner sum can be absorbed into the sum as follows:

$$(-1)^{k-1} (n-1) + \sum_{j=1}^{k-1} (-1)^{j+k-1} n \frac{\log^j n}{j!} = (-1)^k \left( 1 - \sum_{j=0}^{k-1} (-1)^{j} n \frac{\log^j n}{j!} \right)$$ Now, write $1 = \sum_{j=0}^{\infty} (-1)^{j} n \frac{\log^j n}{j!}$. Thus the original sum becomes

$$\mathcal{S} = \sum_{k=1}^\infty \frac{1}{k} \sum_{j=k}^{\infty} (-1)^{j} n \frac{\log^j n}{j!}$$ Now exchange the order of summation $\sum_{k=1}^\infty \sum_{j=k}^\infty \to \sum_{j=1}^\infty \sum_{k=1}^{j}$: $$\mathcal{S} = \sum_{j=1}^\infty \sum_{k=1}^{j} \frac{1}{k} (-1)^{j} n \frac{\log^j n}{j!} = n \sum_{j=1}^\infty (-1)^{j} H_j \frac{\log^j n}{j!}$$

I am not sure at the spot how to manually convert this into logarithmic integral function, but Mathematica can solve this sum in terms of LogIntegral[n]:

In[179]:=
n Sum[(-1)^j HarmonicNumber[j] Log[n]^j/j!, {j, 1, Infinity}] ==
Log[Log[n]] + EulerGamma - LogIntegral[n] // FullSimplify[#, n > 1] &

Out[179]= True

-
Is exchanging the order of infinite sums sound when the terms have different signs? It's not clear to me that the double sum converges absolutely. – Henning Makholm Sep 12 '11 at 19:09
The exchange can be carried out with the upper summation bound fixed at $m$, and later $m$ would be sent to infinity: $\sum_{k=1}^m \sum_{j=k}^m \to \sum_{j=1}^m \sum_{k=1}^{j}$ – Sasha Sep 12 '11 at 19:21
But is it valid to go from $\sum_{k=1}^{\infty}\sum_{j=k}^{\infty}$ to $\lim_{m\to\infty}\sum_{k=1}^m \sum_{j=k}^{m}$ in the first place? – Henning Makholm Sep 12 '11 at 19:25
Regarding that last sum: I suspect manipulations similar to what Srivatsan did here might be useful. In particular, I ended up with the integral $$\int_0^1 \frac{\exp(-zt)-\exp(-z)}{t-1}\mathrm dt$$ after trying it out myself. – J. M. Sep 13 '11 at 10:43