login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A329411 Among the pairwise sums of any three consecutive terms there are exactly two prime sums: lexicographically earliest such sequence of distinct positive numbers. 17

%I #57 May 26 2021 03:08:20

%S 1,2,3,4,7,6,5,8,9,10,13,16,15,14,17,12,11,18,19,22,21,20,23,24,29,30,

%T 31,28,25,33,34,26,27,32,35,36,37,42,41,38,45,44,39,40,43,46,51,50,47,

%U 53,54,48,49,52,55,57,82,56,75,62,64,87,63,76,61,66,65,71,86,60,77,67,72,59,68,69,58,70

%N Among the pairwise sums of any three consecutive terms there are exactly two prime sums: lexicographically earliest such sequence of distinct positive numbers.

%C About existence of this (infinite) sequence: If it is computed in greedy manner, this means that for given n we are given P(n) := {a(n-1), a(n-2)} and have to find a(n) such that we have exactly 1 or 2 primes in a(n) + P(n) depending on whether a(n-1) + a(n-2) is prime or not. It is easy to prove that this is always possible in the first case (1 prime required). In the second case, we must find two larger primes at given distance |a(n-1) - a(n-2)|, necessarily even, since a(n-3) + P(n) contains two primes. To have this infinitely many times, the twin prime conjecture or a variant thereof must hold. However, the sequence need not be computable in greedy manner! That is, if ever for given P(n) (with composite sum) no a(n) would exist such that a(n) + P(n) contains 2 primes, this simply means that the considered value of a(n-1) was incorrect, and the next larger choice has to be made. Given this freedom, there is no doubt about well-definedness of this sequence up to infinity. - _M. F. Hasler_, Nov 14 2019, edited Nov 16 2019

%C Could be extended to a(0) = 0 to yield a sequence of nonnegative integers with the same property, including lexicographic minimality, which is a permutation of the nonnegative integers iff this sequence is a permutation of the positive integers.

%C This is the first known example where the restriction of S(N,M;0) to [1..oo) gives S(N,M;1), where S(N,M;o) is the lexicographically smallest sequence with a(o)=o, N primes among pairwise sums of M consecutive terms, and no duplicate terms: For example, S(0,3;1) = A329405 is not A329450\{0}, S(2,4;1) = A329412 is not A329452\{0}, etc. The second such example is S(4,4;o) = A329449. - _M. F. Hasler_, Nov 16 2019

%C Differs from A055265 from a(30) = 33 on. See the wiki page for further considerations and variants. - _M. F. Hasler_, Nov 24 2019

%H Jean-Marc Falcoz, <a href="/A329411/b329411.txt">Table of n, a(n) for n = 1..10000</a>

%H 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 a(1) = 1 is the smallest possible choice; there's no restriction on the first term.

%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 (out of the required two) with the pair {1, 2}.

%e a(3) = 3 as 3 is the smallest available integer not leading to a contradiction. Since 2 + 3 = 5 we now have our two prime sums with the triplet {1, 2, 3}.

%e a(4) = 4 as 4 is the smallest available integer not leading to a contradiction. Since 3 + 4 = 7 we now have our two prime sums with the triplet {2, 3, 4}: they are 2 + 3 = 5 and 3 + 4 = 7.

%e a(5) = 7 because 5 or 6 would lead to a contradiction: indeed, both the triplets {3, 4, 5} and {3, 4, 6} will produce only one prime sum (instead of two). With a(5) = 7 we have the triplet {3, 4, 7} and the two prime sums we were looking for: 3 + 4 = 7 and 4 + 7 = 11.

%e And so on.

%t a[1]=1;a[2]=2;a[n_]:=a[n]=(k=1;While[Length@Select[Plus@@@Subsets[{a[n-1],a[n-2],++k},{2}],PrimeQ]!=2||MemberQ[Array[a,n-1],k]];k);Array[a,100] (* _Giorgos Kalogeropoulos_, May 09 2021 *)

%o (PARI) A329411(n,show=0,o=1,N=2,M=2,p=[],U,u=o)={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])))); for(k=u,oo, bittest(U,k-u)|| min(c-#[0|p<-p, isprime(p+k)], #p>=M) ||[o=k,break]));show&&print([u]);o} \\ Optional args: show=1: print a(o..n-1), show=-1: append a(o..n-1) to the (global) list L, in both cases print [least unused number] at the end; o=0: start with a(o)=o; N, M: find N primes using M+1 consecutive terms. - _M. F. Hasler_, Nov 16 2019

%Y Cf. A055265 (sum of two consecutive terms is always prime: differs from a(30) on).

%Y Cf. A329412 .. A329416 (exactly 2 prime sums using 4, ..., 10 consecutive terms).

%Y Cf. A329333, A329406 .. A329410 (exactly 1 prime sum using 3, 4, ..., 10 consecutive terms).

%Y Cf. A055266 (no prime sum among 2 consecutive terms), A329405 (no prime among the pairwise sums of 3 consecutive terms).

%Y See also "nonnegative" variants: A253074, A329450 (0 primes using 2 resp. 3 terms), A128280 (1 prime from 2 terms), A329452, A329453 (2 primes from 4 resp. 5 terms), A329454, A329455 (3 primes from 4 resp. 5 terms), A329449, A329456 (4 primes from 4 resp. 5 terms). See the Wiki page for more.

%K nonn

%O 1,2

%A _Eric Angelini_ and _Jean-Marc Falcoz_, Nov 14 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 02:28 EDT 2024. Contains 371782 sequences. (Running on oeis4.)