The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A097457 If n is prime replace with the n-th nonprime otherwise replace with the n-th prime. 3
2, 4, 6, 7, 9, 13, 12, 19, 23, 29, 18, 37, 21, 43, 47, 53, 26, 61, 28, 71, 73, 79, 34, 89, 97, 101, 103, 107, 42, 113, 45, 131, 137, 139, 149, 151, 52, 163, 167, 173, 57, 181, 60, 193, 197, 199, 65, 223, 227, 229, 233, 239, 74, 251, 257, 263, 269, 271, 81, 281, 84, 293 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
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 */
(PARI) A097457 = n->if(isprime(n), A018252(n), prime(n)) \\ M. F. Hasler, Jan 29 2014
CROSSREFS
Cf. A026234.
Sequence in context: A219645 A186708 A227697 * A321612 A121865 A259983
KEYWORD
nonn
AUTHOR
Cino Hilliard, Aug 23 2004
EXTENSIONS
Definition and offset corrected by M. F. Hasler, Jan 29 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 8 13:51 EDT 2024. Contains 373217 sequences. (Running on oeis4.)