login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A163578
If n is prime, a(n) is next composite greater than a(n-1), else if n is composite, a(n) is next prime greater than a(n-1) else 2.
1
2, 4, 6, 7, 8, 11, 12, 13, 17, 19, 20, 23, 24, 29, 31, 37, 38, 41, 42, 43
OFFSET
1,1
EXAMPLE
1 is not prime, a(1)=2, 2 is prime, a(2)=4, 3 is prime, a(3)=6, 4 is composite, a(4)=7.
CROSSREFS
Sequence in context: A165778 A286066 A139527 * A345918 A269389 A092054
KEYWORD
nonn
AUTHOR
Gerald Hillier, Jul 31 2009
STATUS
approved