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 A329566 #13 Sep 26 2021 05:06:15 %S A329566 0,1,2,3,4,24,5,7,6,8,9,10,11,13,18,19,16,12,28,31,17,15,14,22,26,20, %T A329566 21,27,23,30,32,80,41,38,51,39,62,29,35,44,34,45,54,25,49,33,64,36,37, %U A329566 40,46,61,47,42,43,55,66,58,65,48,72,79,52,53,59,78,50,57,60,89,71,56,68,63,74,75,76,69,82,81,67,91,88,70,100 %N A329566 For all n >= 0, exactly six sums are prime among a(n+i) + a(n+j), 0 <= i < j < 6; lexicographically earliest such sequence of distinct nonnegative numbers. %C A329566 That is, there are 6 primes, counted with multiplicity, among the 15 pairwise sums of any 6 consecutive terms. %C A329566 Is this a permutation of the nonnegative integers? %C A329566 If so, then the restriction to [1..oo) is a permutation of the positive integers, but not the lexicographically earliest one with this property, which starts (1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 24, ...). %H A329566 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 A329566 For n = 0, we consider pairwise sums of the first 6 terms a(0..5) = (0, 1, 2, 3, 4, 24): We have (a(i) + a(j), 0 <= i < j < 6) = (1; 2, 3; 3, 4, 5; 4, 5, 6, 7; 24, 25, 26, 27, 28) among which there are 6 primes, counted with repetition. This justifies taking a(0..4) = (0, ..., 4), the smallest possible choices for these first 5 terms. Since no smaller a(5) between 5 and 23 has this property, this is the start of the lexicographically earliest nonnegative sequence with this property and no duplicate terms. %e A329566 Then we find that a(6) = 5 is possible, also giving 6 prime sums for n = 1, so this is the correct continuation (modulo later confirmation that the sequence can be continued without contradiction given this choice). %e A329566 Next we find that a(7) = 6 is not possible, it would give only 5 prime sums using the 6 consecutive terms (2, 3, 4, 24, 5, 6). However, a(7) = 7 is a valid continuation, and so on. %o A329566 (PARI) A329566(n,show=0,o=0,N=6,M=5,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]))));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||[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; o=1: start at a(1)=1; N, M: find N primes using M+1 terms. See the wiki page for a function S() which returns a vector: a(0..n-1) = S(n,6,6). %Y A329566 Cf. A329425 (6 primes using 5 consecutive terms). %Y A329566 Cf. A329449 (4 primes using 4 consecutive terms), A329456 (4 primes using 5 consecutive terms). %Y A329566 Cf. A329454 (3 primes using 4 consecutive terms), A329455 (3 primes using 5 consecutive terms). %Y A329566 Cf. A329411 (2 primes using 3 consecutive terms), A329452 (2 primes using 4 consecutive terms), A329453 (2 primes using 5 consecutive terms). %Y A329566 Cf. A329333 (1 (odd) prime using 3 terms), A128280 & A055265 (1 prime using 2 terms); A055266 & A253074 (0 primes using 2 terms), A329405 & A329450 (0 primes using 3 terms), A329406 ff: other variants. %K A329566 nonn %O A329566 0,3 %A A329566 _M. F. Hasler_, Nov 17 2019