# How to approximate $\text{li}(z)$ numerically?

I'm trying to implement a function to calculate $\pi(x)$ via Riemann's formula: $$\pi(x) = \operatorname{R}(x^1) - \sum_{\rho}\operatorname{R}(x^{\rho}) - \frac1{\ln x} + \frac1\pi \arctan \frac\pi{\ln x} ,$$ with $\operatorname{R}(x) = \sum_{n=1}^{\infty} \frac{ \mu (n)}{n} \operatorname{li}(x^{1/n})$, the sum runs over the non-trivial roots of $\zeta$ and $\text{li}(z)$ being the logarithmic integral.

The problem is that I don't have function to calculate $\text{li}(z)$. Since I'm not familiar with complex limits I'm not sure if I can write it as a simple sum.

BTW, my result for $x=100,n_{max}=1$ and only one root of $\zeta$ is $30.2748$. Can anyone crosscheck that?

-
Can't you use the exponentially converging series by Ramanuajan mentioned in the article to approximate li$(x)$? –  user17762 Jan 9 '13 at 21:15
I guess, you only need it for real $x$? –  user17762 Jan 9 '13 at 21:24
@Marvis No $z=x^{1/2 + it_k}$... –  draks ... Jan 9 '13 at 21:25
Oh ok. I didn't see you wanted $R(x^{\rho})$. –  user17762 Jan 9 '13 at 21:27
I should have an idea about this from your stated purpose, but how accurately do you need to compute this? –  Ron Gordon Jan 9 '13 at 22:02

$\phantom{somespace}$On the Evaluation of the Complex-ValuedExponential Integral