OFFSET
0,3
COMMENTS
That is, there are exactly four primes (counted with multiplicity) among the 6 pairwise sums of any four consecutive terms. This is the theoretical maximum: there can't be a sequence with more than 4 prime sums in any 4 consecutive terms, see the wiki page for details.
This map is defined with offset 0 as to have a permutation of the nonnegative integers in case each of these eventually appears, which is so far only conjectured, see below. The restriction to positive indices would then be a permutation of the positive integers, and as it happens, also the smallest one with the given property. (This is in contrast to most other cases where that one is not the restriction of the other one: see crossrefs).
Concerning the existence of the sequence with infinite length: If the sequence is to be computed in a greedy manner, this means that for given P(n) := {a(n-1), a(n-2), a(n-3)} and thus 0 <= N(n) := #{ primes x + y with x, y in P(n), x < y} <= 4, we have to find a(n) such that we have exactly 4 - N(n) primes in a(n) + N(n). It is easy to prove that this is always possible when 4 - N(n) = 0 or 1. Otherwise, similar to A329452, ..., A329456, we see that P(n) is an "admissible constellation" in the sense that a(n-4) + P(n) already gave the number of primes required now. So a weaker variant of the k-tuple conjecture would ensure we can find this a(n). But the sequence need not be computable in greedy manner! That is, if ever for given P(n) no a(n) would exist such that a(n) + P(n) contains 4 - N(n) primes, this simply means that the considered value of a(n-1) (and possibly a(n-2)) was incorrect, and the next larger choice has to be made. Given this freedom, there is no doubt that this sequence is well defined up to infinity.
Concerning surjectivity: If a number m would never appear, this means that m + P(n) will never have the required number of 4 - N(n) primes for all n with a(n) > m, in spite of having found for each of these n at least two other solutions, a(n-4) + P(n) and a(n) + P(n) which both gave 4 - N(n) primes. This appears extremely unlikely and thus as strong evidence in favor of surjectivity.
See examples for further computational evidence.
LINKS
Eric Angelini, Prime sums from neighbouring terms, personal blog "Cinquante signes" (and post to the SeqFan list), Nov. 11, 2019.
M. F. Hasler, Prime sums from neighboring terms, OEIS Wiki, Nov. 23, 2019.
EXAMPLE
We start with a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 3, the smallest possibilities which do not lead to a contradiction. Indeed, the four sums 0 + 2, 0 + 3, 1 + 2 and 2 + 3 are prime.
Now we have 2 prime sums using {1, 2, 3}, so the next term must give two more prime when added to these. We find that a(4) = 4 is the smallest possible choice, with 1 + 4 = 5 and 3 + 4 = 7.
Then there are again 2 primes among the pairwise sums using {2, 3, 4}, so the next term must again produce two more prime sums. We find that a(5) = 9 is the smallest possibility, with 2 + 9 = 11 and 4 + 9 = 13.
a(10^4) = 9834 and all numbers up to 9834 occurred by then.
a(10^5) = 99840 and all numbers below 99777 occurred by then.
a(10^6) = 1000144 and all numbers below 999402 occurred by then.
PROG
(PARI) A329449(n, show=0, o=0, N=4, M=3, 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])))); 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 a(o..n-1) to the global list L, in both cases print [least unused number] at the end; o=1: start with a(1)=1; N, M: get N primes using M+1 consecutive terms.
CROSSREFS
Other sequences with N primes among pairwise sums of M consecutive terms, starting with a(o) = o, sorted by decreasing N and lowest possible M: A329581 (N=11, M=8, o=0), A329580 (N=10, M=8, o=0), A329569 (N=9, M=6, o=0), A329568 (N=9, M=6, o=1), A329425 (N=6, M=5, o=0), A329449 (N=4, M=4, o=0), A329411 (N=2, M=3, o=0 or 1), A128280 (N=1, M=2, o=0), A055265 (N=1, M=2, o=1), A055266 (N=0, M=2; o=1), A253074 (N=0, M=2; o=0).
KEYWORD
nonn
AUTHOR
M. F. Hasler, based on an idea from Eric Angelini, Nov 15 2019
STATUS
approved