OFFSET
0,3
COMMENTS
That is, there are exactly two primes among the 6 pairwise sums of any four consecutive terms.
Conjectured to be a permutation of the nonnegative numbers.
a(100) = 97, a(1000) = 1001, a(10^4) = 9997, a(10^5) = 10^5, a(10^6) = 999984 and all numbers below 999963 have appeared at that point.
See the wiki page for considerations about existence and surjectivity of the sequence and variants thereof.
LINKS
Eric Angelini, Prime sums from neighbouring terms, personal blog "Cinquante signes" (and post to the SeqFan list), Nov. 11, 2019.
Eric Angelini, Prime sums from neighbouring terms [Cached copy of html file, with permission]
Eric Angelini, Prime sums from neighbouring terms [Cached copy of pdf file, with permission]
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, the smallest possibilities which do not lead to a contradiction.
Now there are already 2 primes, 0 + 2 and 1 + 2, among the pairwise sums, so the next term must not generate any further prime. Given 0 and 1, primes and (primes - 1) are excluded, and a(3) = 8 is the smallest possible choice.
Now there is only one prime, 1 + 2 = 3, among the pairwise sums using {1, 2, 8}; the next term must produce exactly one additional prime as sum with these. We see that 3 is not possible (2 + 3 = 5 and 8 + 3 = 11), but a(4) = 4 is possible.
Now using {2, 8, 4} we have no prime as a pairwise sum, so the next term must produce two primes among the sums with these terms. Again, 3 would give three primes, but 5 yields exactly two primes, 2 + 5 = 7 and 8 + 5 = 13.
PROG
(PARI) A329452(n, show=0, o=0, p=[], U, u=o)={for(n=o, n-1, show&&print1(o", "); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(2<#p, p[^1], p), o); my(c=2-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); if(#p<3, o=u; next); for(k=u, oo, bittest(U, k-u) || sum(i=1, #p, isprime(p[i]+k))!=c || [o=k, break])); print([u]); o} \\ Optional args: show=1: print a(o..n-1); o=1: use indices & terms >= 1, i.e., compute A329412. See the wiki page for more general code returning a vector: S(n, 2, 4) = a(0..n-1).
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
M. F. Hasler, Nov 15 2019
EXTENSIONS
Edited (deleted comments now found on the wiki) by M. F. Hasler, Nov 24 2019
STATUS
approved