6

1

I would like to program the `RiemannR`

function using the `LogIntegral`

command
because I would like to later experiment with a double integral instead of the
`LogIntegral`

function.

I have tried to program the `RiemannR`

function starting with the
`LogIntegral`

command as defined in the Stein-Mazur paper called "Primes":

That agrees almost completely with the definition given in the *Mathematica*
help page about the `RiemannR`

command:

$$R(x)=\sum_n^\infty \mu(n)\mathrm{li}(x^{1/n})/n$$

The only differences I see are that the summation limit $n=1$ is given
in the Stein-Mazur paper while in the *Mathematica* help page it is not.
Also the Stein-Mazur paper uses $\mathrm{Li}$ for the logarithmic integral while
the *Mathematica* help page uses $\mathrm{li}$. However in the *Mathematica* help
page for the `LogIntegral`

command the lower case $\mathrm{li}$ is used.

My problem is that when I enter the following lines:

```
N[RiemannR[1000]]
N[Sum[MoebiusMu[n]*LogIntegral[1000^(1/n)]/n, {n, 1, Infinity}]]
```

in *Mathematica*, I get different numerical values:

```
168.359
168.341
```

What am I doing wrong?

2If you are investigating the prime number theorem, please note the chapter on the zeta function in Wagon's Mathematica In Action, where he refers to a book by H.M. Edwards called Riemann's Zeta Function. Wagon cautions that

`ExpIntegralEi[r Log[x]]`

must be used instead of`LogIntegral[x^r]`

when x is real and r is complex. This is because the complex log function returns`r Log[x]-2 Pi n i`

, with n chosen to make the imaginary part lie between -Pi and Pi, which leads to incorrect sums. – KennyColnago – 2013-06-07T02:34:51.053@Kenny, yes, that's another good reason to use

`ExpIntegralEi[]`

, at least in this context. (I had forgotten to point out that Stan Wagon indeed discussed Riemann's function in his book.) – J. M.'s ennui – 2013-06-07T03:04:10.147