OFFSET
1,2
COMMENTS
That is, there are 12 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
This is the theoretical maximum: there can't be more than 12 primes in pairwise sums of 7 distinct numbers > 1. See the wiki page for more details.
Conjectured to be a permutation of the positive integers. See A329572 for the nonnegative variant (same definition but with n >= 0 and terms >= 0), leading to a quite different sequence.
For a(5) and a(6) one must forbid values up to 8 in order to be able to find a solution for a(7), but from then on, the greedy choice gives the correct solution, at least for several hundred terms. Small values appearing late are a(30) = 5, a(34) = 6, a(28) = 7, a(62) = 8.
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
Up to and including the 6th term, there is no constraint other than not using a term more than once, since it is impossible to have more than 12 primes as pairwise sums of 6 numbers. So one would first try to use the lexicographically smallest possible choice a(1..6) =?= (1, 2, ..., 6). But then one would have only 7 pairs (i,j) such that a(i) + a(j) is prime, 1 <= i < j <= 6. So one would need 12 - 7 = 5 more primes in {1, 2, ..., 6} + a(7), which is impossible. One can check that even a(1..5) =?= (1,...,5) does not allow one to find a(6) and a(7) in order to have 12 prime sums a(i) + a(j), 1 <= i < j <= 7. Nor is it possible to find a solution with a(5) equal to 6 or 7 or 8. One finds that a(5) = 9, and a(6) = 10, are the smallest possible choices for which a(7) can be found as to satisfy the requirement. In that case, a(7) = 27 is the smallest possible solution, which yields the 12 prime sums 1+2, 2+3, 1+4, 3+4, 2+9, 4+9, 1+10, 3+10, 9+10, 2+27, 4+27, 10+27.
Now, to satisfy the definition of the sequence for n = 2, we drop the initial 1 from the set of consecutive terms, and search for a(8) producing the same number of additional primes together with {2, 3, 4, 9, 10, 27} as did a(1) = 1, namely 3. We see that a(8) = 14 is the smallest possibility. And so on.
It seems that once a(5) and a(6) are chosen, one may always take the smallest possible choice for the next term without ever again running into difficulty. This is in strong contrast to the (exceptional) case of the variant where we require 10 prime sums among 7 consecutive terms, cf. sequence A329574.
PROG
(PARI) {A329573(n, show=0, o=1, N=12, M=6, D=[5, 9, 6, 10], 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); D&& D[1]==n&& [o=D[2], D=D[3..-1]]&& next; 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|p<-p, isprime(p+k)], #p>=M)|| [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. See the wiki page for more.
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 09 2020
STATUS
approved