OFFSET
0,3
COMMENTS
That is, there are nine primes, counted with multiplicity, among the 15 pairwise sums of any six consecutive terms. This is the maximum: there can't be more than 9 primes among the pairwise sums of any 6 numbers > 1, cf. wiki page in LINKS.
Conjectured to be a permutation of the nonnegative integers. The restriction to [1,oo) is then a permutation of the positive integers with similar properties, but different from the lexico-smallest one, A329568 = (1, 2, 3, 9, 4, 10, 27, ...).
For n > 5, a(n) is the smallest number not used earlier such that the set a(n) + {a(n-5}, ..., a(n-1)} has the same number of primes as a(n-6) + {a(n-5), ..., a(n-1)}. Such a number always exists, by definition of the sequence. (If it would not exist for a given n, the term a(n-1) (or earlier) "is wrong and must be corrected", so to say.) See the wiki page for further considerations about existence and surjectivity.
For a(3) and a(4), one must exclude values 3 & 4 to be able to continue the sequence indefinitely, but in all other cases (at least for several hundred terms), the greedy choice gives the correct solution.
The values 3, 4 and 7 appear quite late at indices 25, 24 resp. 47.
LINKS
Éric Angelini, Prime sums from neighbouring terms, SeqFan list, Nov 11 2019.
M. F. Hasler, Prime sums from neighboring terms, OEIS Wiki, Nov 23 2019.
PROG
(PARI) {A329569(n, show=0, o=0, N=9, M=5, X=[[3, 3], [3, 4], [4, 3], [4, 4]], p=[], u=o, U)=for(n=o+1, n, 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])))); for(k=u, oo, bittest(U, k-u)|| min(c-#[0|x<-p, isprime(x+k)], #p>=M)|| setsearch(X, [n, k])|| [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. Parameters N, M, o, ... allow getting other variants, see the wiki page for more.
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 10 2020
STATUS
approved