OFFSET
1,3
COMMENTS
pi(n) is the prime counting function, A000720.
Equals row sums of triangle A143541. - Gary W. Adamson, Aug 23 2008
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = pi(n)*(pi(n) - pi(n-1)), pi = A000720. - Reinhard Zumkeller, Nov 30 2003
MAPLE
MATHEMATICA
Table[PrimePi[n] * Boole[PrimeQ[n]], {n, 92}] (* Jean-François Alcover, Nov 07 2011, after R. J. Mathar *)
Table[If[PrimeQ[n], PrimePi[n], 0], {n, 100}] (* Harvey P. Dale, Jan 09 2022 *)
PROG
(Haskell)
import Data.List (unfoldr)
a049084 n = a049084_list !! (fromInteger n - 1)
a049084_list = unfoldr x (1, 1, a000040_list) where
x (i, z, ps'@(p:ps)) | i == p = Just (z, (i + 1, z + 1, ps))
| i /= p = Just (0, (i + 1, z, ps'))
-- Reinhard Zumkeller, Apr 17 2012, Mar 31 2012, Sep 15 2011
(PARI) a(n)=if(isprime(n), primepi(n), 0) \\ Charles R Greathouse IV, Jan 08 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Name clarified by Alonso del Arte, Feb 07 2020 at the suggestion of David A. Corneth
STATUS
approved