OFFSET
1,2
COMMENTS
This is the lexicographically first such sequence starting with a(1)=1 and being always extended with the smallest integer not yet present that doesn't lead to a contradiction.
The sequence is a permutation of the integers > 0.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..23012
EXAMPLE
The blocks of primes are indicated here by parentheses; the successive block-sizes are 1, 2, 4, 3, 5,... which reproduces the sequence itself:
1,(2),4,(3,5),6,(7,11,13,17),8,9,10,12,14,15,16,18,(19,23,29),20,21,22,24,25,26,27,28,30,(31,37,41,43,47),32,33,.
MATHEMATICA
a = {1}; b = 1; c = Select[Range[10^4], CompositeQ]; Do[k = b + a[[i]] - 1; a = Join[a, Join[Prime@ Range[b, k], If[Prime@ b == 2, {4}, TakeWhile[c, # < NextPrime@ Prime@ k &] ] ]]; c = DeleteCases[c, k_ /; k <= Last@ a]; b = k + 1, {i, 8}]; a (* Michael De Vlieger, Jul 25 2016 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Jul 23 2016
STATUS
approved