OFFSET
1,2
COMMENTS
Here is the succession of nonprimes and primes in the sequence:
1, 3, 2, 5, 6, 4, 8, 7, 10, 11, 12, 9, 13, 16, 14, 18, 15,
n p p p n n n p n p n n p n n n n
The same succession is formed by a(n) + a(n+1):
4, 5, 7, 11, 10, 12, 15, 17, 21, 23, 21, 22, 29, 30, 32, 33, 32
n p p p n n n p n p n n p n n n n
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Carole Dubois, Jun 30 2021
STATUS
approved