trying to compute Riemann's prime counting function J(x)

18 views (last 30 days)
I am trying to compute Riemann's prime counting function J(x):
1_ip75YSGVNaVsMMhUZCx6JA.png
J(x) should approximate the numbers of primes <= x using this code:
function J_RiemannPrimeCount = J(x)
if x < 2
error("x must be >= 2");
end
integral_fun = @(t) (1 ./ (t.*(t.^2-1).*log(t)));
integral_term = integral(integral_fun,x,Inf);
zetaZeros = 0.5 + csvread("first 100k zeros of the Riemann zeta.txt") .* i;
maxZero = 35;
k = 1:1:maxZero;
Li_term = logint(x.^zetaZeros(k)) - logint(2);
Li_sum = sum(Li_term);
J_RiemannPrimeCount = (logint(x) - logint(2)) - Li_sum - log(2) + integral_term;
end
The file "first 100k zeros of the Riemann zeta.txt" contains the Imag-values of the Riemann-zeta-function for Re = 0.5 (example: 14.134725142, 21.022039639, 25.010857580, 30.424876126, 32.935061588, ....) . I am using the first maxZero=35 of these to approximate J(x).
The periodic term "Li_sum = sum(Li_term)" is not correct - everything else should be fine. ( I am somewhat worried, that I am doing a super-stupid mistake here... )
Can anyone help nonetheless .. ??
  1 Comment
Thomas
Thomas on 6 Oct 2019
Hi , would still greatly appreciate if anyone has an idea on this here:
When calculating the explicit Riemann prime counting function J(x) for x=2,...,1000 using the program below, I get an oscillating term Li_sum that looks like in the diagram (see attachement). The local maxima are in the right place (= at the exact locations of the prime numbers): however Li_sum should not be descending in the way it is doing here, but should be distributed around zero, since it is "only" the error term in the smooth estimation. So there must be a kind of "adjustment"-factor somewhere - maybe resulting from the fact that Li_sum is the truncated version of a conditionally convergent series.
% explicit Riemann Prime Counting function J
function J_RiemannPrimeCount = J(x)
if x < 2
error("x must be >= 2");
end
integral_fun = @(t) (1 ./ (t.*(t.^2-1).*log(t)));
integral_term = integral(integral_fun,x,Inf);
zetaZeros = 0.5 + csvread("first 100k zeros of the Riemann zeta.txt") .* i;
maxZero = 1000;
k = 1:1:maxZero;
Li_term = logint(x .^ zetaZeros(k)) + logint(x .^ (1-zetaZeros(k))) - 2*logint(2) ;
Li_sum = sum(Li_term);
J_RiemannPrimeCount_smooth = (logint(x) - logint(2)) - log(2) + integral_term; % prime estimation without oscillating term
J_RiemannPrimeCount = (logint(x) - logint(2)) - log(2) + integral_term - Li_sum; % prime counting with oscillating term
end
Any idea, where the error could be ... ???
Li_sum for first 1k zeros of zeta.jpg

Sign in to comment.

Answers (2)

Jyothis Gireesh
Jyothis Gireesh on 18 Sep 2019
Here are a few pointers which may help with resolving the issue:
  • The second term in the Reimann’s function is computed by taking the logarithmic integral over x raised to non-trivial zeros of the zeta function.
  • Since the sum is ‘conditionally convergent’, the summation should be done by taking the zeros of zeta function in a pair-wise fashion (taking ρ and 1-ρ) as follows
In the code given above, by restricting the zeros to the first 35 entries in the "first 100k zeros of the Riemann zeta.txt" file you may be violating the pair-wise summation condition causing the sum to diverge. So for ρ value in the first 35 entries you may add the corresponding 1-ρ value as well so that the sum term converges.
  7 Comments
Miguel Camarasa
Miguel Camarasa on 29 Mar 2021
I see, I don't understand why. Anyway, when I run the J2 function, it doesn't seem to get a nice approximation between the number of primes in [2,100] with 100 roots of the Zeta Function. Maybe something is missing?
Thomas
Thomas on 30 Mar 2021
I think the approximation becomes better for large x in J2(x) But I did not look into this in detail...

Sign in to comment.


Johannes van Ek
Johannes van Ek on 27 Mar 2021
Very interesting. I have the same problem. Did you manage to resolve this issue?
I do the summation over the conjugate pairs and it diverges.
I found a paper in Cantor's Paradise on this and it quotes converging results with 35 roots (and 100 roots), and it presents nice graphs of J(x). I do not know how the author got these results.
I also tried the cos(alpa(ln(x)) formulation from riemann's original paper. No success either. Puzzled.
  6 Comments
Johannes van Ek
Johannes van Ek on 30 Mar 2021
It is because of branch points of li(x^rho) at 0 an 1 that care needs to ve taken. Anyway, it works now. On to the million dollars!
Irene Chen
Irene Chen on 1 Aug 2021
Do you know how to deal with the branch points? This is so confusing......

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!