OFFSET
0,3
COMMENTS
That is, there are 10 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
Conjectured to be a permutation of the nonnegative integers.
If it is, then the restriction to [1..oo) is a permutation of the positive integers, but maybe not the lexicographically earliest one with this property.
This is the first example of a sequence of this type for which the greedy choice of a(n) is frequently incorrect beyond the initial terms, see Examples.
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS Wiki, Nov. 23, 2019, updated Feb. 2020.
EXAMPLE
At the beginning of the sequence, we must avoid the choice of 6 or 7 for a(6): both appear to be possible at first sight, giving exactly 10 prime sums with n = 0 in the definition, but then make it impossible to find a successor term a(7) for which the definition is satisfied with n = 1.
The same happens again for a(37) and a(58), where the apparently possible value 19 resp. 46 must be avoided.
PROG
(PARI) {A329574(n, show=0, o=0, N=10, M=6, X=[[6, 6], [6, 7], [37, 19], [58, 46]], 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