login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = floor( Li(n) - pi(n) ).
2

%I #25 Feb 07 2023 17:11:11

%S 0,0,0,0,1,0,1,1,2,1,2,1,1,2,2,1,2,1,1,2,2,1,2,2,2,3,3,2,3,2,2,2,3,3,

%T 3,3,3,3,3,3,3,2,2,3,3,2,2,3,3,3,3,3,3,3,3,4,4,3,3,3,3,3,3,4,4,3,3,4,

%U 4,3,3,3,3,3,3,3,4,3,3,3,4,3,3,3,4,4,4,3,3,4,4,4,4,5,5,4,4,4,5,4,4,3,3,4,4

%N a(n) = floor( Li(n) - pi(n) ).

%C Li(x) is the logarithmic integral of x.

%C pi(x) is the number of primes less than or equal to x, A000720(x).

%C "The Riemann hypothesis is an assertion about the size of the error term in the prime number theorem, namely, that pi(x) = li(x)+O(x^(1/2+epsilon))", see Nathanson, page 323.

%D Melvyn B. Nathanson, Elementary Methods in Number Theory, Springer, 2000

%F a(n) = A047783(n) - A000720(n).

%p a:= n-> floor(evalf(Li(n)))-numtheory[pi](n):

%p seq(a(n), n=2..120); # _Alois P. Heinz_, Feb 23 2017

%t iend = 100;

%t For[x = 1, x <= iend, x++,

%t a[x] = N[LogIntegral[x] - PrimePi[x]]]; t =

%t Table[Floor[a[i]], {i, 2, iend}]; Print[t]

%t Table[Floor[LogIntegral[n] - PrimePi[n]], {n, 2, 110}] (* _G. C. Greubel_, May 17 2019 *)

%o (PARI) vector(110, n, n++; floor(real(-eint1(-log(n))) - primepi(n)) ) \\ _G. C. Greubel_, May 17 2019

%o (Magma) [Floor(LogIntegral(n) - #PrimesUpTo(n)): n in [2..110]]; // _G. C. Greubel_, May 17 2019

%o (Sage) [floor(li(n) - prime_pi(n)) for n in (2..110)] # _G. C. Greubel_, May 17 2019

%Y Cf. A000720, A047783, A052435, A359145.

%K sign

%O 2,9

%A _David S. Newman_, Feb 23 2017