login
A117668
a(n) is the n-th prime number if n is prime; a(n) is the n-th nonprime number otherwise.
0
1, 3, 5, 8, 11, 10, 17, 14, 15, 16, 31, 20, 41, 22, 24, 25, 59, 27, 67, 30, 32, 33, 83, 35, 36, 38, 39, 40, 109, 44, 127, 46, 48, 49, 50, 51, 157, 54, 55, 56, 179, 58, 191, 62, 63, 64, 211, 66, 68, 69, 70, 72, 241, 75, 76, 77, 78, 80, 277, 82, 283, 85, 86, 87, 88, 90, 331, 92, 93, 94, 353, 96, 367, 99, 100
OFFSET
1,2
EXAMPLE
a(1) is the first nonprime: 1.
a(2) is the second prime: 3.
MATHEMATICA
Module[{nn=100, np, pr, len}, np=Select[Range[nn], !PrimeQ[#]&]; len = Length[ np]; pr=Prime[Range[len]]; Table[If[PrimeQ[n], pr[[n]], np[[n]]], {n, len}]] (* Harvey P. Dale, Oct 01 2021 *)
CROSSREFS
Sequence in context: A127700 A101907 A242250 * A184410 A184332 A326711
KEYWORD
nonn
AUTHOR
Luc Stevens (lms022(AT)yahoo.com), Apr 11 2006
EXTENSIONS
Definition corrected by Michel Marcus, Jun 01 2013
Corrected and extended by Harvey P. Dale, Oct 01 2021
STATUS
approved