login
Number of primes <= n, starting at n=0.
3

%I #59 Mar 16 2023 09:47:31

%S 0,0,1,2,2,3,3,4,4,4,4,5,5,6,6,6,6,7,7,8,8,8,8,9,9,9,9,9,9,10,10,11,

%T 11,11,11,11,11,12,12,12,12,13,13,14,14,14,14,15,15,15,15,15,15,16,16,

%U 16,16,16,16,17,17,18,18,18,18,18,18,19,19,19,19,20,20,21,21,21,21,21,21

%N Number of primes <= n, starting at n=0.

%C Essentially identical to A000720, except that sequence, being an arithmetical sequence, starts at n = 1. - _N. J. A. Sloane_, Jun 21 2017

%C Also, on the first quadrant of the square grid, consider a diagram in which the number of cells in the horizontal bar of the k-th row is equal to the k-th prime, see example. The total length of the boundary segments between the structure formed by the first k horizontal bars and the structure formed by the vertical bars, from [0, 0], is equal to A014688(k). a(n) is the number of cells in the vertical bar of the n-th column.

%C Note that in a similar diagram for A000720 the lengths of the horizontal bars give A006093 (primes minus 1) not A000040 (the prime numbers) because A000720 has only one zero, not two.

%C Also, the number of distinct prime factors of the factorial number n!. - _Torlach Rush_, Jan 17 2014

%C The lengths of the boundary horizontal segments between the structure formed by the horizontal bars and the structure formed by the vertical bars of the diagram gives A054541. The zig-zag path formed by the boundary segments is in A230850. - _Omar E. Pol_, Jun 22 2017

%H Vincenzo Librandi, <a href="/A230980/b230980.txt">Table of n, a(n) for n = 0..5000</a>

%e Illustration of initial terms:

%e . _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

%e 31 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|

%e 29 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | |

%e 23 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | |

%e 19 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | |

%e 17 |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | |

%e 13 |_ _ _ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | |

%e 11 |_ _ _ _ _ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | |

%e 7 |_ _ _ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | |

%e 5 |_ _ _ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | |

%e 3 |_ _ _| | | | | | | | | | | | | | | | | | | | | | | | | | | | |

%e 2 |_ _|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|

%e .

%e n: 0 1 2 3 4 5 6 7 8 9...

%e a(n): 0 0 1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 10 10

%t Array[PrimePi@# &, 90, 0] (* _Robert G. Wilson v_, Jun 21 2017 *)

%t Accumulate[Table[If[PrimeQ[n],1,0],{n,0,100}]] (* _Harvey P. Dale_, Mar 16 2023 *)

%o (Magma) [0] cat [#PrimesUpTo(n-1): n in [2..200] ]; // _Vincenzo Librandi_, Jun 22 2017

%o (PARI) a(n)=primepi(n) \\ _Charles R Greathouse IV_, Jun 23 2017

%Y Cf. A000040, A000720, A001223, A006093, A007504, A014688, A054541, A141042, A182986, A230850.

%Y Partial sums of A010051.

%K nonn

%O 0,4

%A _Omar E. Pol_, Nov 02 2013

%E Offset and definition changed by _N. J. A. Sloane_, Jun 21 2017