%I #73 Oct 20 2024 03:54:11
%S 2,7,13,19,23,29,37,43,47,53,61,71,73,79,89,97,101,103,107,113,131,
%T 137,139,149,151,163,167,173,181,193,197,199,223,227,229,233,239,251,
%U 257,263,269,271,281,293,307,311,313,317,337,347,349,359,373
%N Primes p such that pi(p) is not prime.
%C Primes prime(k) such that A049076(k)=1, sorted along increasing k. - _R. J. Mathar_, Jan 28 2014
%C The complement of A006450 (primes with prime index) within the primes A000040.
%D C. Kimberling, Fractal sequences and interspersions, Ars Combinatoria, vol. 45 p 157 1997.
%H R. Zumkeller, <a href="/A007821/b007821.txt">Table of n, a(n) for n = 1..1000</a>
%H Lubomir Alexandrov, <a href="http://arxiv.org/abs/math/9811096">On the nonasymptotic prime number distribution</a>, arXiv:math/9811096 [math.NT], 1998.
%H N. Fernandez, <a href="http://www.borve.org/primeness/FOP.html">An order of primeness, F(p)</a>
%H N. Fernandez, <a href="/A006450/a006450.html">An order of primeness</a> [cached copy, included with permission of the author]
%F A137588(a(n)) = n; a(n) = A000040(A018252(n)). - _Reinhard Zumkeller_, Jan 28 2008
%F A000040 = A007821 U A006450. - _Juri-Stepan Gerasimov_, Sep 24 2009
%F A175247 U { a(n); n > 1 } = A000040. { a(n) } = { 2 } U { primes (A000040) with composite index (A002808) }. - _Jaroslav Krizek_, Mar 13 2010
%F 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
%p A007821 := proc(n) ithprime(A018252(n)) ; end proc: # _R. J. Mathar_, Jul 07 2012
%t Prime[ Select[ Range[75], !PrimeQ[ # ] &]] (* _Robert G. Wilson v_, Mar 15 2004 *)
%t With[{nn=100},Pick[Prime[Range[nn]],Table[If[PrimeQ[n],0,1],{n,nn}],1]] (* _Harvey P. Dale_, Aug 14 2020 *)
%o (Haskell)
%o a007821 = a000040 . a018252
%o a007821_list = map a000040 a018252_list
%o -- _Reinhard Zumkeller_, Jan 12 2013
%o (PARI) forprime(p=2, 1e3, if(!isprime(primepi(p)), print1(p, ", "))) \\ _Felix Fröhlich_, Aug 16 2014
%o (Python)
%o from sympy import primepi
%o def A007821(n):
%o def bisection(f,kmin=0,kmax=1):
%o while f(kmax) > kmax: kmax <<= 1
%o while kmax-kmin > 1:
%o kmid = kmax+kmin>>1
%o if f(kmid) <= kmid:
%o kmax = kmid
%o else:
%o kmin = kmid
%o return kmax
%o def f(x): return n+x-(p:=primepi(x))+primepi(p)
%o return bisection(f,n,n) # _Chai Wah Wu_, Oct 19 2024
%Y Cf. A049076, A049078, A049079, A049080, A049081, A058322, A058324, A058325, A058326, A058327, A058328, A093046, A006450.
%Y 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.
%K nonn
%O 1,1
%A Monte J. Zerger (mzerger(AT)cc4.adams.edu), _Clark Kimberling_
%E Edited by _M. F. Hasler_, Jul 31 2015