This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A329567 #33 Dec 23 2024 14:53:46 %S A329567 0,1,2,3,4,8,5,11,26,15,9,32,14,17,20,21,27,10,16,19,7,12,13,24,6,23, %T A329567 35,25,37,18,36,22,31,61,28,30,39,40,43,33,64,38,45,34,29,63,50,44,53, %U A329567 42,59,47,54,48,41,90,49,55,52,108,58,46,51,121,73,78,76,100,79,81,151,60,67,112,70,69,82,62,87,57,80,111,56,71,66,68,86,83,65 %N A329567 For all n >= 0, exactly seven sums are prime among a(n+i) + a(n+j), 0 <= i < j < 6: lexicographically earliest such sequence of distinct nonnegative numbers. %C A329567 That is, there are 7 primes, counted with multiplicity, among the 15 pairwise sums of any 6 consecutive terms. %C A329567 Conjectured to be a permutation of the nonnegative integers. The restriction to [1,oo) is then a permutation of the positive integers with the same property, but not the smallest one which is A329576 = (1, 2, 3, 4, 5, 8, 11, ...). %C A329567 For n > 5, a(n) is the smallest number not used earlier such that the set a(n) + {a(n-5), ..., a(n-1)} has the same number of primes as a(n-6) + {a(n-5), ..., a(n-1)}. Such a number always exists, by definition of the sequence. (If it would not exist for a given n, this means the term a(n-1) (or earlier) "was wrong and must be corrected", so to say. Of course this only refers to an incorrect computation.) %H A329567 Éric Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2019-November/020145.html">Prime sums from neighbouring terms</a>, SeqFan list, Nov 11 2019. %H A329567 Éric Angelini, <a href="/A329567/a329567.txt">Prime sums from neighbouring terms</a>, SeqFan list, Nov 11 2019. [Cached copy, with permission] %H A329567 Eric Angelini, <a href="/A329333/a329333.htm">Prime sums from neighbouring terms</a>, personal blog "Cinquante signes" [Cached copy of html file, with permission] %H A329567 Eric Angelini, <a href="/A329333/a329333.pdf">Prime sums from neighbouring terms</a>, personal blog "Cinquante signes" [Cached copy of pdf file, with permission] %H A329567 M. F. Hasler, <a href="/wiki/User:M._F._Hasler/Prime_sums_from_neighboring_terms">Prime sums from neighboring terms</a>, OEIS wiki, Nov. 23, 2019. %e A329567 Using the smallest possible 5 initial terms a(0..4) = (0, 1, 2, 3, 4), we have a total of 6 primes among the pairwise sums, namely 0+2, 0+3, 1+2, 1+4, 2+3 and 3+4. To satisfy the definition for n = 0, the next term a(5) must give exactly one more prime when added to these 5 initial terms. The smallest number with this property is 6, but this choice of a(5) would make it impossible to find a suitable a(7): Indeed, for n = 1 we must consider the pairwise sums of (1, 2, 3, 4, a(5), a(6)). If we had (1, 2, 3, 4, 6, a(6)), the first 5 terms would give 5 prime sums 1+2, 1+4, 1+6, 2+3 and 3+4. Then a(6) should give two more prime sums, which is easily possible, either with even a(6) such that 1+a(6) and 3+a(6) are prime, or odd a(6) such that two among {2, 4, 6} + a(6) are prime. Thereafter, for n = 2, we drop the 1 and include a(7) instead, which must produce the same number of prime sums when added to {2, 3, 4, 6, a(6)} as was the case for 1. For even a(6) this was 4 (1+2, 1+4, 1+6 and 1+a(6)), which is impossible to achieve with a(7) > 1, since 2+x, 4+x and 6+x can't be all prime for x > 1. For odd a(6) it is 3 (1+2, 1+4 and 1+6), which is also impossible as well for odd a(7) (same reason as before) as for even a(7) (since only 3 and a(6) are odd and can give a prime sum). %e A329567 This shows that we can't take a(5) equal to 6, and must consider the next larger possibility, which is a(5) = 8 (with prime sum 3+8 = 11, while 7 would give more than one, 0+7 and 4+7). Now we find that the smallest possible a(6) = 5 yields a solution and all subsequent terms can also be chosen greedily. %o A329567 (PARI) {A329567(n,show=1,o=0,N=7,M=5,X=[[4,6]],p=[],u=o,U)=for(n=o,n-1, 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])))); if(#p<M&&sum(i=1,#p,isprime(p[i]+u))<=c,o=u)|| for(k=u,oo,bittest(U,k-u)|| sum(i=1,#p,isprime(p[i]+k))!=c|| 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. See the wiki page for a function S() which returns a vector: a(0..n-1) = S(7,6;0). %Y A329567 Cf. related sequences with N prime sums using M consecutive terms, labeled (N,M): A329425 (6,5), A329566 (6,6), A329449 (4,4), A329456 (4,5), A329454 & A329416 (3,4), A329455 (3,5), A329411 (2,3), A329452 (2,4), A329453 (2,5), A329333 (1,3), A128280 & A055265 (1,2); A055266 & A253074 (0,2), A329405 & A329450 (0,3), A329406 - A329416: (1,4) ... (2,10). %K A329567 nonn %O A329567 0,3 %A A329567 _M. F. Hasler_, Feb 09 2020