A052435 a(n) = round(li(n) - pi(n)), where li is the logarithmic integral and pi(x) is the number of primes <= x.
0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 4, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 4, 5, 5, 5, 4, 5, 4
Offset: 2
Links
- Harry J. Smith, Table of n, a(n) for n = 2..20000
- C. Caldwell, How many primes are there?
- Patrick Demichel, The prime counting function and related subjects, April 05, 2005, 75 pages.
- Eric Weisstein's World of Mathematics, Prime Counting Function
- Eric Weisstein's World of Mathematics, Logarithmic Integral
- Eric Weisstein's World of Mathematics, Skewes Number
Programs
-
Magma
[Round(LogIntegral(n) - #PrimesUpTo(n)): n in [2..105]]; // G. C. Greubel, May 17 2019
-
Mathematica
Table[Round[LogIntegral[x]-PrimePi[x]], {x,2,100}]
-
PARI
a(n)=round(real(-eint1(-log(n)))-primepi(n)) \\ Charles R Greathouse IV, Oct 28 2011
-
Sage
[round(li(n) - prime_pi(n)) for n in (2..105)] # G. C. Greubel, May 17 2019
Comments