OFFSET
1,1
FORMULA
a(n) = A345966(n) for n >= 7. - Pontus von Brömssen, Jul 03 2021
EXAMPLE
Here is the succession of primes and nonprimes in the sequence:
2, 1, 3, 4, 5, 6, 8, 7, 10, 11, 12, 9, 13, 16, 14, 18, 15, ...
p n p n p n n p n p n n p n n n n
The same succession is formed by a(n) + a(n+1):
3, 4, 7, 9, 11, 14, 15, 17, 21, 23, 21, 22, 29, 30, 32, 33, 32, ...
p n p n p n n p n p n n p n n n n
MATHEMATICA
seq[n_] := Module[{s = {2}, 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, Jul 02 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Carole Dubois, Jul 02 2021
STATUS
approved