OFFSET
1,4
COMMENTS
a(n) = n - A000720(n). This is asymptotic to n - Li(n). Note that a(n) + A095117(n) = 2*n. - Jonathan Vos Post, Nov 22 2004
Same as number of primes between n and prime(n+1) and between n and prime(n)+1 (end points excluded); n prime -> a(n)=a(n-1), n composite-> a(n)=1+a(n-1). - David James Sycamore, Jul 23 2018
There exists at least one prime number between a(n) and n for n >= 3 (see the paper by Ya-Ping Lu attached in the links). - Ya-Ping Lu, Nov 27 2020
LINKS
Harry J. Smith, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = n - A000720(n).
a(n) = 1 + A065855(n). - David James Sycamore, Jul 23 2018
EXAMPLE
a(19) = 11 as there are 8 primes up to 19 (inclusive).
MAPLE
NumComposites := proc(N::posint) local count, i:count := 0:for i from 1 to N do if not isprime(i) then count := count + 1 fi:od: count; end:seq(NumComposites(binomial(k+1, k)), k=0..73); # Zerinvary Lajos, May 26 2008
A062298 := proc(n) n-numtheory[pi](n) ; end: seq(A062298(n), n=1..120) ; # R. J. Mathar, Sep 27 2009
MATHEMATICA
Table[n-PrimePi[n], {n, 80}] (* Harvey P. Dale, May 10 2012 *)
Accumulate[Table[If[PrimeQ[n], 0, 1], {n, 100}]] (* Harvey P. Dale, Feb 15 2017 *)
PROG
(PARI) a(n) = n-primepi(n); \\ Harry J. Smith, Aug 04 2009
(Haskell)
a062298 n = a062298_list !! (n-1)
a062298_list = scanl1 (+) $ map (1 -) a010051_list
-- Reinhard Zumkeller, Oct 10 2013
(Magma) [n - #PrimesUpTo(n): n in [1..100]]; // Vincenzo Librandi, Aug 05 2015
(Python)
from sympy import primepi
print([n - primepi(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 29 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 19 2001
EXTENSIONS
Corrected and extended by Vladeta Jovovic, Jun 22 2001
STATUS
approved