OFFSET
1,2
COMMENTS
nps(n,0) -> list nonprime(n) or the sequence of nonprime numbers. nps(n,1) -> list nonprime(nonprime(n)) or nps of order 1 nps(n,2) -> list nonprime(nonprime(nonprime(n))) or nps of order 2 ..... The order is the number of nestings - 1. We avoid the nestings in the script with a loop.
Nonprimes (A018252) with nonprime (A018252) subscripts. a(n) U A078782(n) = A018252(n), a(n+1) U A175250(n) = A018252(n) for n >= 1. a(n) = nonprime(nonprime(n)) = A018252(A018252(n)). a(4) = 14 because a(4) = b(b(4)) = b(8) = 14, b = nonprime. a(1) = 1, a(n) = nonprimes (A018252) with composite (A002808) subscripts for n >=2. [Jaroslav Krizek, Mar 13 2010]
EXAMPLE
Nonprime(2) = 4.
Nonprime(4) = 8 the second entry.
MAPLE
# For Maple code for the prime/nonprime compound sequences (listed in cross-references) see A003622. - N. J. A. Sloane, Mar 30 2016
MATHEMATICA
nonPrime[n_] := FixedPoint[n + PrimePi[ # ] &, n]; Nest[nonPrime, Range[66], 2] (* Robert G. Wilson v, Feb 04 2005 *)
PROG
(PARI) \We perform nesting(s) with a loop. cics(n, m) = { local(x, y, z); for(x=1, n, z=x; for(y=1, m+1, z=composite(z); ); print1(z", ") ) } composite(n) = \ The n-th composite number. 1 is defined as a composite number. { local(c, x); c=1; x=0; while(c <= n, x++; if(!isprime(x), c++); ); return(x) }
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Jan 31 2005
EXTENSIONS
Edited by Robert G. Wilson v, Feb 04 2005
STATUS
approved