cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A120843 Initial digit of the (10^n)-th prime.

Original entry on oeis.org

2, 2, 5, 7, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Views

Author

Cino Hilliard, Aug 18 2006

Keywords

Comments

The algorithm in the PARI program approximates the (10^n)-th prime to an accuracy of roughly n/2 + 1 digits. As a result, we are almost certain to get the initial digit correctly. It remains to prove this. Since the Riemann approximation of pi(x) is used as a boundary in the exponential bisection routine, it would seem that a proof is possible in view of the fact that bisection almost always guarantees convergence. "Almost" is an appropriate term here, as will be demonstrated when we let the initial parameter r2 = 1. For example, we can toggle print(dx) to check the convergence. For primex(1e116), we get 9.999999999999999999999999970 E115.

Examples

			The (10^3)-th prime is 7919, so a(3)=7.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := RealDigits[ n (Log[n] + Log[Log[n]] - 1 + (Log[Log[n]] - 2)/Log[n] - (Log[Log[n]]^2 - 6 Log[Log[n]] + 11)/(2 Log[n]^2)), 10, 10][[1, 1]]; f[1] = f[10] = 2; f[100] = 5; Array[ f[10^#] &, 105, 0] (* Robert G. Wilson v, Jan 15 2017 *)
  • PARI
    g(n) = print1(2", "); for(x=1, n, y=Vec(Str(primex(10^x))); print1(y[1]", "))
    primex(n) = /* Efficient Algorithm to accurately approximate the n-th prime */ { local(x, px, r1, r2, r, p10, b, e); b=10; /*Select base*/ p10=log(n)/log(10); /*p10=pow of 10 n is to adjust in b^p10*/ if(Rg(b^p10*log(b^(p10+1)))< b^p10, m=p10+1, m=p10); r1 = 0; r2 = 2.718281828; /*Real kicker. if 1, it fails at 1e117*/ for(x=1, 360, r=(r1+r2)/2; px = Rg(b^p10*log(b^(m+r))); if(px <= b^p10, r1=r, r2=r); r=(r1+r2)/2.; ); (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^100*r, s=s+r/zeta(n+1)/n; n=n+1; r=r*L/n); (s) }

Formula

a(n) = most significant digit of A006988(n). - Robert G. Wilson v, Jan 17 2017
a(n) = A000030(A006988(n)). - Michel Marcus, Jan 18 2017