Riemann Prime Counting Function:
$$f(x)=\operatorname{li}(x)-\sum_\rho\operatorname{li}(x^\rho)-\ln 2+\int_x^\infty \frac{\mathrm dt}{t(t^2-1)\ln t}$$
The second correction/paring terms:
$$\sum_\rho\operatorname{li}(x^\rho)=\sum_{I[\rho]>0}[\operatorname{Li}(x^\rho)+\operatorname{Li}(x^{1-\rho})]$$
I tried to use Mathematica function LogIntegral
to plot this second correction/paring terms, for example, when I only include the first 2 non-trivial zeros, and plot with range x from 1 to 5:
Plot[Sum[LogIntegral[x^ZetaZero[k]] + LogIntegral[x^(1 - ZetaZero[k])],
{k, 1, 2}], {x, 1, 5}]
However, I got very large value instead of small correction:
I can also use simplified equation provided by reference 1:
$$\operatorname{li}(x^\rho)=\operatorname{li}(e^{\rho \log x})\sim \frac{e^{\rho \log x}}{\rho \log x}$$
Plot[Sum[Exp[ZetaZero[k]*Log[x]]/(ZetaZero[k]*Log[x]), {k, 1, 2}] +
Sum[Exp[(1 -ZetaZero[k])*Log[x]]/((1 - ZetaZero[k])*Log[x]),
{k, 1, 2}], {x, 1, 5}]
Then I got the correct result:
Anyone knows what is wrong for the LogIntegral
one?
Thank you!
RiemannR
is built in so you could always use that. One reason your correction is bad is because $\mathrm{Li}(x)$ is not the same as $\mathrm{li}(x)$. You should code $\mathrm{li}(x)$ asLogIntegral[x]
, but $\mathrm{Li}(x)$ asLogIntegral[x]-LogIntegral[2]
, however there is still something else wrong as the correction is still too large. $\endgroup$- LogIntegral[2]
doesn't give the correct answer. It just shift the trend a little bit down.RiemannR
only gives the mobius function of first major prime counting term. It does not contain the correction terms. therefore if you plotRiemannR
, only a smooth counting curve could be generated, instead of a "zigzag" curve following the real prime number distribution. $\endgroup$