%I #23 Nov 28 2019 11:02:15
%S 1,2,3,7,13,19,5,8,9,17,16,40,4,6,11,12,10,14,22,18,15,20,24,26,25,29,
%T 28,52,30,35,21,23,33,31,32,27,39,37,38,43,36,48,44,46,34,45,42,50,41,
%U 54,49,69,51,47,57,60,53,55,59,58,61,56,66,65,63,67,62,78,68,70,64,71,72,73,75,81,82,80
%N Lexicographically earliest sequence of distinct positive numbers such that among the pairwise sums of any six consecutive terms there are exactly two prime sums.
%C Condition a(1) = 1 follows from minimality. Conjectured to be a permutation of the positive integers: a(10^6) = 999994 and all numbers up to there have appeared at that point. - _M. F. Hasler_, Nov 15 2019
%H Jean-Marc Falcoz, <a href="/A329414/b329414.txt">Table of n, a(n) for n = 1..10000</a>
%e a(1) = 1 by minimality.
%e a(2) = 2 as 2 is the smallest available integer not leading to a contradiction. Note that as 1 + 2 = 3 we already have one prime sum (on the required two) with the sextuplet {1,2,a(3),a(4),a(5),a(6)}.
%e a(3) = 3 as 3 is the smallest available integer not leading to a contradiction. Note that as 2 + 3 = 5 we now have the two prime sums required with the sextuplet {1,2,3,a(4),a(5),a(6)}.
%e a(4) = 7 as a(4) = 4, 5 or 6 would lead to a contradiction: indeed, the sextuplets {1,2,3,4,a(5),a(6)}, {1,2,3,5,a(5),a(6)} and {1,2,3,6,a(5),a(6)} will produce more than the two required prime sums. With a(4) = 7 we have no contradiction as the sextuplet {1,2,3,7,a(5),a(6)} has now exactly two prime sums: 1 + 2 = 3 and 2 + 3 = 5.
%e a(5) = 13 as a(5) = 4, 5, 6, 8, 9, 10, 11 or 12 would again lead to a contradiction (more than 2 prime sums with the sextuplet); in combination with any other term before it, a(5) = 13 will produce only composite sums.
%e a(6) = 19 as 19 is the smallest available integer not leading to a contradiction: indeed, the sextuplet {1,2,3,7,13,19} shows exactly the two prime sums we are looking for: 1 + 2 = 3 and 2 + 3 = 5.
%e a(7) = 5 as 5 is the smallest available integer not leading to a contradiction; indeed, the sextuplet {2,3,7,13,19,5} shows exactly two prime sums, which are 2 + 3 = 5 and 2 + 5 = 7.
%e And so on.
%o (PARI) A329414(n,show=0,o=1,N=2,M=5,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(#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])); print([u]);o} \\ Optional args: show=1: print terms a(o..n-1); o=0: start with a(0)=0; N, M: produce N primes using M+1 consecutive terms. - _M. F. Hasler_, Nov 15 2019
%Y Cf. A329333 (3 consecutive terms, exactly 1 prime sum). See also A329450, A329452 onwards.
%K nonn
%O 1,2
%A _Eric Angelini_ and _Jean-Marc Falcoz_, Nov 14 2019
|