A123233 Difference between the (10^n)-th prime and the Riemann-Gram approximation of the (10^n)-th prime.
1, 0, 5, -4, -39, -24, 1823, -6566, -1844, -34087, 84846, -449836, -1117632, -3465179, -1766196, -11290074, 105510354, -208774399, 704933861
Offset: 0
Examples
a(1) = prime(10) - primeGR(10) = 29 - 29 = 0.
Programs
-
PARI
primeGR(n) = \\ A good approximation for the n-th prime number using \\ the Gram-Riemann approximation of Pi(x) { local(x,px,r1,r2,r,p10,b,e); b=10; p10=log(n)/log(10); if(Rg(b^p10*log(b^(p10+1)))< b^p10,m=p10+1,m=p10); r1 = 0; r2 = 7.18281828; for(x=1,400, r=(r1+r2)/2; px = Rg(b^p10*log(b^(m+r))); if(px <= b^p10,r1=r,r2=r); r=(r1+r2)/2; ); floor(b^p10*log(b^(m+r))+.5); } Rg(x) = \\ Gram's Riemann's Approx of Pi(x) { local(n=1,L,s=1,r); L=r=log(x); while(s<10^40*r, s=s+r/zeta(n+1)/n; n=n+1; r=r*L/n); (s) }
Formula
prime(10^x)-primeRG(10^x), where prime(n) is the n-th prime and primeRG(n)is an approximation of the n-th prime number based on an exponential bisection routine that uses the Riemann-Gram approximation of Pi(x). The flow of the routine is evident in the PARI script below.
Extensions
a(17)-a(18) from Amiram Eldar, Jul 04 2024
Comments