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.

A007821 Primes p such that pi(p) is not prime.

Original entry on oeis.org

2, 7, 13, 19, 23, 29, 37, 43, 47, 53, 61, 71, 73, 79, 89, 97, 101, 103, 107, 113, 131, 137, 139, 149, 151, 163, 167, 173, 181, 193, 197, 199, 223, 227, 229, 233, 239, 251, 257, 263, 269, 271, 281, 293, 307, 311, 313, 317, 337, 347, 349, 359, 373
Offset: 1

Views

Author

Monte J. Zerger (mzerger(AT)cc4.adams.edu), Clark Kimberling

Keywords

Comments

Primes prime(k) such that A049076(k)=1, sorted along increasing k. - R. J. Mathar, Jan 28 2014
The complement of A006450 (primes with prime index) within the primes A000040.

References

  • C. Kimberling, Fractal sequences and interspersions, Ars Combinatoria, vol. 45 p 157 1997.

Crossrefs

Let A = primes A000040, B = nonprimes A018252. The 2-level compounds are AA = A006450, AB = A007821, BA = A078782, BB = A102615. The 3-level compounds AAA, AAB, ..., BBB are A038580, A049078, A270792, A102617, A270794, A270795, A270796, A102616.

Programs

  • Haskell
    a007821 = a000040 . a018252
    a007821_list = map a000040 a018252_list
    -- Reinhard Zumkeller, Jan 12 2013
    
  • Maple
    A007821 := proc(n) ithprime(A018252(n)) ; end proc: # R. J. Mathar, Jul 07 2012
  • Mathematica
    Prime[ Select[ Range[75], !PrimeQ[ # ] &]] (* Robert G. Wilson v, Mar 15 2004 *)
    With[{nn=100},Pick[Prime[Range[nn]],Table[If[PrimeQ[n],0,1],{n,nn}],1]] (* Harvey P. Dale, Aug 14 2020 *)
  • PARI
    forprime(p=2, 1e3, if(!isprime(primepi(p)), print1(p, ", "))) \\ Felix Fröhlich, Aug 16 2014
    
  • Python
    from sympy import primepi
    def A007821(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-(p:=primepi(x))+primepi(p)
        return bisection(f,n,n) # Chai Wah Wu, Oct 19 2024

Formula

A137588(a(n)) = n; a(n) = A000040(A018252(n)). - Reinhard Zumkeller, Jan 28 2008
A175247 U { a(n); n > 1 } = A000040. { a(n) } = { 2 } U { primes (A000040) with composite index (A002808) }. - Jaroslav Krizek, Mar 13 2010
G.f. over nonprime powers: Sum_{k >= 1} prime(k)*x^k-prime(prime(k))*x^prime(k). - Benedict W. J. Irwin, Jun 11 2016

Extensions

Edited by M. F. Hasler, Jul 31 2015