cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A049084 a(n) = pi(n) if n is prime, otherwise 0.

Original entry on oeis.org

0, 1, 2, 0, 3, 0, 4, 0, 0, 0, 5, 0, 6, 0, 0, 0, 7, 0, 8, 0, 0, 0, 9, 0, 0, 0, 0, 0, 10, 0, 11, 0, 0, 0, 0, 0, 12, 0, 0, 0, 13, 0, 14, 0, 0, 0, 15, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 17, 0, 18, 0, 0, 0, 0, 0, 19, 0, 0, 0, 20, 0, 21, 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, 0, 0, 0, 0, 0, 24, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

pi(n) is the prime counting function, A000720.
Equals row sums of triangle A143541. - Gary W. Adamson, Aug 23 2008

Crossrefs

a(n) = A091227(A091202(n)).
Cf. A143541.

Programs

  • 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
    
  • Maple
    A049084 := proc(n)
        local i;
        if isprime(n) then
            for i from 1 do
                if ithprime(i) = n then
                    return i;
                end if;
            end do;
        else
            return 0 ;
        fi;
    end proc:
    seq(A049084(n),n=1..120) ;
  • 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 *)
  • PARI
    a(n)=if(isprime(n),primepi(n),0) \\ Charles R Greathouse IV, Jan 08 2013

Formula

a(n) = pi(n)*(pi(n) - pi(n-1)), pi = A000720. - Reinhard Zumkeller, Nov 30 2003
a(n) = A000720(n*A010051(n)). - Labos Elemer, Jan 09 2004
a(n) = A000720(n)*A010051(n). - R. J. Mathar, Mar 01 2011

Extensions

Name clarified by Alonso del Arte, Feb 07 2020 at the suggestion of David A. Corneth