OFFSET
1,1
EXAMPLE
4 is composite so replace it with prime(4) = 7, the 4th entry in the table.
PROG
(PARI) flipcomppr(n) = { for(x=1, n, if(isprime(x), y=composite(x), y=prime(x)); print1(y", ") ) } /* the n-th composite */ composite(n) = { local(c, x); c=1; x=0; while(c <= n, x++; if(!isprime(x), c++); ); return(x) } /* Note: for more efficient code, see A018252 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Aug 23 2004
EXTENSIONS
Definition and offset corrected by M. F. Hasler, Jan 29 2014
STATUS
approved