A329565 For all n >= 0, exactly five sums are prime among a(n+i) + a(n+j), 0 <= i < j < 6; lexicographically earliest such sequence of distinct nonnegative numbers.
0, 1, 2, 3, 6, 24, 4, 5, 8, 9, 10, 11, 7, 13, 12, 17, 16, 14, 15, 19, 22, 18, 21, 20, 26, 23, 25, 27, 33, 34, 28, 29, 32, 38, 39, 30, 31, 41, 40, 36, 35, 42, 61, 44, 43, 66, 37, 52, 45, 47, 46, 51, 50, 57, 48, 49, 53, 55, 56, 59, 54, 58, 72, 95, 62, 65, 67, 63, 84, 64, 60, 68, 89, 71, 69, 73, 80, 78, 70, 79, 87, 76, 75, 74, 88, 77, 81, 82, 189, 85
Offset: 0
Keywords
Examples
For n = 0, we consider pairwise sums of the first 6 terms a(0..5) = (0, 1, 2, 3, 6, 24): We have (a(i) + a(j), 0 <= i < j < 6) = (1; 2, 3; 3, 4, 5; 6, 7, 8, 9; 24, 25, 26, 27, 30) among which there are 5 primes, counted with repetition. If one tries to take a(4) equal to 4 or 5, this yields already 6 primes among the pairwise sums of the first 5 terms, so the smallest possible choice is a(4) = 6, and thereafter any a(5) less than 24 would again yield too many prime sums. So (0, 1, 2, 3, 6, 24) is indeed the start of the lexicographically earliest nonnegative sequence with the required properties. Then one finds that a(6) = 4 is possible, giving also 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). Next one finds that a(7) = 5 is also possible, and so on.
Links
- M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
Crossrefs
Programs
-
PARI
{A329565(n,show=0,o=0,N=5/*#primes*/,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
Comments