login
The succession of nonprime and prime terms is kept when you consider the sequence formed by the successive sums a(n) + a(n+1). This is the lexicographically earliest sequence of distinct positive terms with this property.
1

%I #15 Jul 18 2021 10:47:30

%S 1,3,2,5,6,4,8,7,10,11,12,9,13,16,14,18,15,17,20,19,22,23,24,21,25,26,

%T 28,27,29,30,32,31,36,33,35,34,38,37,42,39,41,48,40,44,43,46,45,47,50,

%U 49,51,53,54,52,56,55,57,58,59,68,60,61,66,62,63,65,64,69,67,70,71,78,72,73,76,74,79,84,75,77

%N The succession of nonprime and prime terms is kept when you consider the sequence formed by the successive sums a(n) + a(n+1). This is the lexicographically earliest sequence of distinct positive terms with this property.

%C Here is the succession of nonprimes and primes in the sequence:

%C 1, 3, 2, 5, 6, 4, 8, 7, 10, 11, 12, 9, 13, 16, 14, 18, 15,

%C n p p p n n n p n p n n p n n n n

%C The same succession is formed by a(n) + a(n+1):

%C 4, 5, 7, 11, 10, 12, 15, 17, 21, 23, 21, 22, 29, 30, 32, 33, 32

%C n p p p n n n p n p n n p n n n n

%t seq[n_] := Module[{s = {1}, q, k}, Do[q = PrimeQ[s[[-1]]]; k = 1; While[!FreeQ[s, k] || PrimeQ[s[[-1]] + k] != q, k++]; AppendTo[s, k], {n}]; s]; seq[100] (* _Amiram Eldar_, Jun 30 2021 *)

%Y Cf. A094044.

%K nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, Jun 30 2021