[go: up one dir, main page]

login
A329411 revision #56

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
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, 31, 28, 25, 33, 34, 26, 27, 32, 35, 36, 37, 42, 41, 38, 45, 44, 39, 40, 43, 46, 51, 50, 47, 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
OFFSET
1,2
COMMENTS
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
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.
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
Differs from A055265 from a(30) = 33 on. See the wiki page for further considerations and variants. - M. F. Hasler, Nov 24 2019
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
a(1) = 1 is the smallest possible choice; there's no restriction on the first term.
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}.
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}.
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.
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.
And so on.
MATHEMATICA
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 *)
PROG
(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
CROSSREFS
Cf. A055265 (sum of two consecutive terms is always prime: differs from a(30) on).
Cf. A329412 .. A329416 (exactly 2 prime sums using 4, ..., 10 consecutive terms).
Cf. A329333, A329406 .. A329410 (exactly 1 prime sum using 3, 4, ..., 10 consecutive terms).
Cf. A055266 (no prime sum among 2 consecutive terms), A329405 (no prime among the pairwise sums of 3 consecutive terms).
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.
Sequence in context: A267308 A264965 A266644 * A055265 A117922 A266643
KEYWORD
nonn
AUTHOR
STATUS
reviewed