OFFSET
1,2
COMMENTS
nps(n,1) -> list nonprime(n) or the sequence of nonprime numbers. nps(n,2) -> list nonprime(nonprime(n)) or nps of order 2. nps(n,3) -> list nonprime(nonprime(nonprime(n))) or npcs of order 3 ..... The order is the number of nestings - 1.
EXAMPLE
Nonprime(2) = 4.
Nonprime(4) = 8.
Nonprime(8) = 14, the 2nd 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[62], 3] (* 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