login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A329452
There are exactly two primes in {a(n+i) + a(n+j), 0 <= i < j <= 3} for any n: lexicographically earliest such sequence of distinct nonnegative integers.
29
0, 1, 2, 8, 4, 5, 6, 3, 7, 11, 10, 9, 12, 13, 28, 15, 17, 16, 20, 14, 21, 22, 19, 23, 25, 24, 29, 30, 26, 18, 35, 31, 32, 27, 34, 36, 33, 38, 37, 40, 63, 39, 41, 44, 42, 45, 47, 50, 51, 43, 52, 49, 46, 48, 53, 54, 57, 55, 56, 58, 69, 62, 59, 65, 66, 61, 60, 67, 64, 68, 70, 81, 72, 76, 73, 75, 71
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
Cf. A329412 (analog for positive integers), A329453 (2 primes in a(n+i)+a(n+j), i < j < 5).
Cf. A329333 (one odd prime among a(n+i)+a(n+j), 0 <= i < j < 3), A329450 (no prime in a(n+i)+a(n+j), i < j < 3).
Sequence in context: A178592 A348683 A301389 * A222238 A019611 A138287
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