OFFSET
0,3
COMMENTS
That is, there are 6 primes, counted with multiplicity, among the 15 pairwise sums of any 6 consecutive terms.
Is this a permutation of the nonnegative integers?
If so, then the restriction to [1..oo) is a permutation of the positive integers, but not the lexicographically earliest one with this property, which starts (1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 24, ...).
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
For n = 0, we consider pairwise sums of the first 6 terms a(0..5) = (0, 1, 2, 3, 4, 24): We have (a(i) + a(j), 0 <= i < j < 6) = (1; 2, 3; 3, 4, 5; 4, 5, 6, 7; 24, 25, 26, 27, 28) among which there are 6 primes, counted with repetition. This justifies taking a(0..4) = (0, ..., 4), the smallest possible choices for these first 5 terms. Since no smaller a(5) between 5 and 23 has this property, this is the start of the lexicographically earliest nonnegative sequence with this property and no duplicate terms.
Then we find that a(6) = 5 is possible, also giving 6 prime sums for n = 1, so this is the correct continuation (modulo later confirmation that the sequence can be continued without contradiction given this choice).
Next we find that a(7) = 6 is not possible, it would give only 5 prime sums using the 6 consecutive terms (2, 3, 4, 24, 5, 6). However, a(7) = 7 is a valid continuation, and so on.
PROG
(PARI) A329566(n, show=0, o=0, N=6, M=5, p=[], U, u=o)={for(n=o, n-1, if(show>0, print1(o", "), show<0, listput(L, o)); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); if(#p<M&&sum(i=1, #p, isprime(p[i]+u))<=c, o=u)|| for(k=u, oo, bittest(U, k-u)|| sum(i=1, #p, isprime(p[i]+k))!=c||[o=k, break])); show&&print([u]); o} \\ optional args: show=1: print a(o..n-1), show=-1: append them on global list L, in both cases print [least unused number] at the end; o=1: start at a(1)=1; N, M: find N primes using M+1 terms. See the wiki page for a function S() which returns a vector: a(0..n-1) = S(n, 6, 6).
CROSSREFS
Cf. A329425 (6 primes using 5 consecutive terms).
Cf. A329411 (2 primes using 3 consecutive terms), A329452 (2 primes using 4 consecutive terms), A329453 (2 primes using 5 consecutive terms).
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 17 2019
STATUS
approved