cp's OEIS Frontend

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.

Showing 1-10 of 13 results. Next

A055265 a(n) is the smallest positive integer not already in the sequence such that a(n)+a(n-1) is prime, starting with a(1)=1.

Original entry on oeis.org

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, 34, 27, 26, 33, 38, 35, 32, 39, 40, 43, 36, 37, 42, 41, 48, 49, 52, 45, 44, 53, 50, 47, 54, 55, 46, 51, 56, 57, 70, 61, 66, 65, 62, 69, 58, 73, 64, 63, 68, 59, 72, 67, 60
Offset: 1

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

The sequence is well-defined (the terms must alternate in parity, and by Dirichlet's theorem a(n+1) always exists). - N. J. A. Sloane, Mar 07 2017
Does every positive integer eventually occur? - Dmitry Kamenetsky, May 27 2009. Reply from Robert G. Wilson v, May 27 2009: The answer is almost certainly yes, on probabilistic grounds.
It appears that this is the limit of the rows of A051237. That those rows do approach a limit seems certain, and given that that limit exists, that this sequence is the limit seems even more likely, but no proof is known for either conjecture. - Robert G. Wilson v, Mar 11 2011, edited by Franklin T. Adams-Watters, Mar 17 2011
The sequence is also a particular case of "among the pairwise sums of any M consecutive terms, N are prime", with M = 2, N = 1. For other M, N see A055266 & A253074 (M = 2, N = 0), A329333, A329405 - A329416, A329449 - A329456, A329563 - A329581, and the OEIS Wiki page. - M. F. Hasler, Feb 11 2020

Examples

			a(5) = 7 because 1, 2, 3 and 4 have already been used and neither 4 + 5 = 9 nor 4 + 6 = 10 are prime while 4 + 7 = 11 is prime.
		

Crossrefs

Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - Reinhard Zumkeller, Apr 03 2006
Cf. A086527 (the primes a(n)+a(n-1)).
Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - Zak Seidov, Oct 19 2011
See also A076990, A243625.
See A282695 for deviation from identity sequence.
A073659 is a version where the partial sums must be primes.

Programs

  • Haskell
    import Data.List (delete)
    a055265 n = a055265_list !! (n-1)
    a055265_list = 1 : f 1 [2..] where
       f x vs = g vs where
         g (w:ws) = if a010051 (x + w) == 1
                       then w : f w (delete w vs) else g ws
    -- Reinhard Zumkeller, Feb 14 2013
    
  • Maple
    A055265 := proc(n)
        local a,i,known ;
        option remember;
        if n =1 then
            1;
        else
            for a from 1 do
                known := false;
                for i from 1 to n-1 do
                    if procname(i) = a then
                        known := true;
                        break;
                    end if;
                end do:
                if not known and isprime(procname(n-1)+a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A055265(n),n=1..100) ; # R. J. Mathar, Feb 25 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! PrimeQ[a + k], k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* Robert G. Wilson v, May 27 2009 *)
    q=2000; a={1}; z=Range[2,2*q]; While[Length[z]>q-1, k=1; While[!PrimeQ[z[[k]]+Last[a]], k++]; AppendTo[a,z[[k]]]; z=Delete[z,k]]; Print[a] (*200 times faster*) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
  • PARI
    v=[1];n=1;while(n<50,if(isprime(v[#v]+n)&&!vecsearch(vecsort(v),n), v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 01 2015
    
  • PARI
    U=-a=1; vector(100,k, k=valuation(1+U+=1<M. F. Hasler, Feb 11 2020

Formula

a(2n-1) = A128280(2n-1) - 1, a(2n) = A128280(2n) + 1, for all n >= 1. - M. F. Hasler, Feb 11 2020

Extensions

Corrected by Hans Havermann, Sep 24 2002

A329405 Among the pairwise sums of any three consecutive terms there is no prime: lexicographically earliest such sequence of distinct positive integers.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 14, 2, 4, 6, 8, 10, 12, 15, 18, 17, 16, 19, 20, 25, 24, 21, 27, 23, 22, 26, 28, 29, 34, 31, 32, 33, 30, 35, 39, 37, 38, 40, 36, 41, 44, 43, 42, 45, 46, 47, 48, 51, 54, 57, 58, 53, 52, 59, 56, 49, 50, 55, 60, 61, 62, 63, 66, 67, 68, 65, 64, 69, 71, 72, 70, 73, 74, 79, 76, 77, 78
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Nov 13 2019

Keywords

Comments

Conjectured to be a permutation of the positive integers.
From M. F. Hasler, Nov 14 2019: (Start)
Equivalently: For any n, neither a(n) + a(n+1) nor a(n) + a(n+2) is prime. Or: For any n and 0 <= i < j <= 2, a(n+i) + a(n+j) is never prime.
See A329450, A329452 onward and the wiki page for variants and further considerations about existence, surjectivity, etc. of such sequences. (End)

Examples

			a(1) = 1 from minimality.
a(2) = 3 since 2 would produce 3 (a prime) by making 1 + 2.
a(3) = 5 since 2 or 4 would produce a prime (e.g., 3 + 4 = 7).
a(4) = 7 since 2, 4 or 6 would produce a prime (e.g., 5 + 6 = 11).
...
a(8) = 14 as 2, 4, 6, 8, 10 or 12 would produce a prime together with a(7) = 13 or a(6) = 11.
a(9) = 2 as neither 2 + 13 = 15 nor 2 + 14 = 16 is prime.
And so on.
		

Crossrefs

Cf. A329333 (3 consecutive terms, exactly 1 prime sum).
Cf. A329406 .. A329410 (exactly 1 prime sum using 4, ..., 10 consecutive terms).
Cf. A329411 .. A329416 (exactly 2 prime sums using 3, ..., 10 consecutive terms).
See also A329450, A329452 onwards for "nonnegative" variants.

Programs

  • Mathematica
    a[1]=1;a[2]=3;a[n_]:=a[n]=(k=1;While[Or@@PrimeQ[Plus@@@Subsets[{a[n-1],a[n-2],++k},{2}]]||MemberQ[Array[a,n-1],k]];k);Array[a,100] (* Giorgos Kalogeropoulos, May 09 2021 *)
  • PARI
    A329405(n, show=1, o=1, p=o, U=[])={for(n=o, n-1, show&&print1(p", "); U=setunion(U, [p]); while(#U>1&&U[1]==U[2]-1, U=U[^1]); for(k=U[1]+1, oo, setsearch(U, k) || isprime(o+k) || isprime(p+k) || [o=p, p=k, break])); p} \\ Optional args: show=0: don't print the list; o=0: start with a(0) = 0, i.e., compute A329450. See the wiki page for more general code returning a vector: S(n,0,3,1) = a(1..n).

Extensions

Edited by N. J. A. Sloane, Nov 15 2019

A329425 For all n >= 0, six among (a(n+i) + a(n+j), 0 <= i < j < 5) are prime: lexicographically first such sequence of distinct nonnegative integers.

Original entry on oeis.org

0, 1, 2, 3, 4, 9, 8, 10, 33, 14, 93, 20, 17, 23, 44, 6, 24, 35, 65, 5, 18, 32, 11, 12, 29, 30, 7, 31, 72, 16, 22, 25, 37, 15, 46, 64, 43, 28, 85, 19, 54, 13, 88, 34, 49, 39, 40, 27, 100, 57, 26, 52, 111, 21, 38, 45, 62, 41, 51, 56, 47, 116, 50, 81, 63, 68, 59, 170, 69, 71
Offset: 0

Views

Author

M. F. Hasler, following an idea from Eric Angelini, Nov 24 2019

Keywords

Comments

The restriction to [1, oo) is the lexicographically first such sequence of positive integers. (This is rather exceptional, cf. A128280 vs A055265, A329405 vs A329450, ..., see the wiki page for more.)
Conjectured to be a permutation, i.e., all n >= 0 appear. The restriction to [1, oo) is then the lexicographically first such permutation of the positive integers.
Among pairwise sums of 5 consecutive terms, there cannot be more than 2 x 3 = 6 primes: see the wiki page for this and further considerations and variants.

Crossrefs

Cf. A055265, A128280 (1 prime from 2 terms), A329333 (1 prime from 3 terms), A329405-A329416 (N primes from M terms >= 1), A329449, ..., A329581 (N primes from M terms >= 0).

Programs

  • Maple
    R:= 0,1,2,3,4:
    S:= {R}:
    for i from 1 to 100 do
      for x from 5 do
        if member(x,S) then next fi;
        n1:= nops(select(isprime,[seq(seq(R[i+j]+R[i+k],j=1..k-1),k=1..4)]));
        if nops(select(isprime,[seq(R[i+j]+x,j=1..4)]))+n1 = 6 then
          R:= R, x; S:= S union {x}; break
        fi
    od od:
    R; # Robert Israel, Dec 29 2022
  • PARI
    A329425_upto(N) = S(N,6,5,0) \\ see the wiki page for the function S().

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

Original entry on oeis.org

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

Views

Author

Eric Angelini and Jean-Marc Falcoz, Nov 14 2019

Keywords

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

Examples

			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.
		

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.

Programs

  • 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 *)
  • 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

A329410 Among the pairwise sums of any ten consecutive terms there is exactly one prime sum: lexicographically earliest such sequence of distinct positive numbers.

Original entry on oeis.org

1, 2, 7, 8, 13, 14, 19, 20, 25, 26, 108, 32, 37, 38, 44, 50, 10, 40, 12, 18, 28, 48, 105, 6, 4, 16, 24, 30, 36, 42, 54, 56, 9, 46, 22, 60, 66, 68, 72, 76, 78, 82, 93, 34, 52, 62, 43, 83, 92, 102, 23, 53, 3, 29, 31, 27, 33, 41, 15, 88, 5, 11, 17, 35, 45, 47, 55, 57, 21, 64, 51, 59, 61, 65, 39, 69, 71, 77, 79, 136, 49, 67, 63
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Nov 13 2019

Keywords

Examples

			a(1) = 1 by minimality.
a(2) = 2 as 2 is the smallest available integer not leading to a contradiction. Note that as 1 + 2 = 3 we have already the prime sum we need.
a(3) = 7 as a(3) = 3, 4, 5 or 6 would produce at least one prime sum too many.
a(4) = 8 as a(4) = 3, 4, 5 or 6 would again produce at least one prime sum too many.
a(5) = 13 as a(5) = 3, 4, 5, 6, 9, 10, 11 or 12 would also produce at least one prime sum too many.
a(6) = 14 as a(6) = 14 doesn't produce an extra prime sum - only composite sums.
a(7) = 19 as a(7) = 3, 4, 5, 6, 9, 10, 11, 12, 15, 16, 17 or 18 would produce at least a prime sum too many.
a(8) = 20 as a(8) = 20 doesn't produce an extra prime sum - only composite sums.
a(9) = 25 as a(9) = 3, 4, 5, 6, 9, 10, 11, 12, 15, 16, 17, 18, 21, 22, 23 or 24 would produce at least a prime sum too many.
a(10) = 26 as(10) = 26 doesn't produce an extra prime sum - only composite sums.
a(11) = 108 is the smallest available integer that produces the single prime sum we need among the last 10 integers {2,7,8,13,14,19,20,25,26,108}, which is 127 = 108 + 19.
And so on.
		

Crossrefs

Cf. A329333 (3 consecutive terms, exactly 1 prime sum).
Cf. A329405 (no prime among the pairwise sums of 3 consecutive terms).
Cf. A329406 .. A329409 (exactly 1 prime sum using 4, ..., 7 consecutive terms).
Cf. A329411 .. A329416 (exactly 2 prime sums using 3, ..., 10 consecutive terms).
See also A329450, A329452 onwards for "nonnegative" variants.

A329569 For all n >= 0, exactly 9 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 6: lexicographically earliest such sequence of distinct nonnegative numbers.

Original entry on oeis.org

0, 1, 2, 5, 6, 11, 12, 17, 26, 35, 36, 47, 24, 77, 32, 65, 62, 149, 74, 9, 8, 39, 14, 15, 4, 3, 28, 33, 38, 69, 10, 51, 20, 21, 58, 93, 16, 81, 46, 13, 70, 27, 76, 37, 34, 97, 52, 7, 30, 49, 40, 31, 22, 67, 82, 19, 42, 25, 64, 85, 18, 109, 54, 43, 88, 139, 84, 145, 94, 79, 112, 55, 48, 289, 144
Offset: 0

Views

Author

M. F. Hasler, Feb 10 2020

Keywords

Comments

That is, there are nine primes, counted with multiplicity, among the 15 pairwise sums of any six consecutive terms. This is the maximum: there can't be more than 9 primes among the pairwise sums of any 6 numbers > 1, cf. wiki page in LINKS.
Conjectured to be a permutation of the nonnegative integers. The restriction to [1,oo) is then a permutation of the positive integers with similar properties, but different from the lexico-smallest one, A329568 = (1, 2, 3, 9, 4, 10, 27, ...).
For n > 5, a(n) is the smallest number not used earlier such that the set a(n) + {a(n-5), ..., a(n-1)} has the same number of primes as a(n-6) + {a(n-5), ..., a(n-1)}. Such a number always exists, by definition of the sequence. (If it would not exist for a given n, the term a(n-1) (or earlier) "is wrong and must be corrected", so to say.) See the wiki page for further considerations about existence and surjectivity.
For a(3) and a(4), one must exclude values 3 & 4 to be able to continue the sequence indefinitely, but in all other cases (at least for several hundred terms), the greedy choice gives the correct solution.
The values 3, 4 and 7 appear quite late at indices 25, 24 resp. 47.

Crossrefs

Cf. A055265, A128280 (1 prime from 2 terms), A329333 (1 prime from 3 terms), A329405, ..., A329416 (N primes from M terms >= 1), A329425, A329449, ..., A329581 (N primes from M terms >= 0).

Programs

  • PARI
    {A329569(n,show=0,o=0,N=9,M=5,X=[[3,3],[3,4],[4,3],[4,4]],p=[],u=o,U)=for(n=o+1,n, 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|x<-p,isprime(x+k)],#p>=M)|| setsearch(X,[n,k])|| [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. Parameters N,M,o,... allow getting other variants, see the wiki page for more.

A329572 For all n >= 0, exactly 12 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 7; lexicographically earliest such sequence of distinct nonnegative numbers.

Original entry on oeis.org

0, 1, 2, 5, 6, 11, 12, 17, 26, 35, 36, 47, 24, 54, 77, 7, 43, 60, 13, 30, 96, 4, 67, 97, 16, 133, 34, 3, 40, 27, 63, 100, 10, 20, 171, 9, 8, 51, 21, 22, 52, 15, 32, 38, 75, 141, 56, 41, 71, 122, 152, 45, 68, 29, 59, 14, 39, 44, 50, 23, 53, 57, 74, 107, 170, 176, 93, 134, 137, 86, 177, 65, 476, 62, 87, 92, 101
Offset: 0

Views

Author

M. F. Hasler, Feb 09 2020

Keywords

Comments

That is, there are 12 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
This is the theoretical maximum: there can't be more than 12 primes in pairwise sums of 7 distinct numbers > 1. See the wiki page for more details.
Conjectured to be a permutation of the nonnegative integers. See A329573 for the "positive" variant: same definition but with offset 1 and positive terms, leading to a quite different sequence.
For a(3) and a(4) resp. a(5) one must forbid the values < 5 resp. < 11 which would be the greedy choices, in order to get a solution for a(7), but from then on, the greedy choice gives the correct solution, at least for several hundred terms.

Crossrefs

Cf. A055273 (analog starting with a(1) = 1), A055265 & A128280 (1 prime using 2 terms), A055266 & A253074 (0 primes using 2 terms), A329405 - A329416, A329425, A329333, A329449 - A329456, A329563 - A329581.

Programs

  • PARI
    {A329572(n,show=0,o=0,N=12,M=6,D=[3,5,4,6,5,11],p=[],u=o,U)=for(n=o+1,n, 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); D&& D[1]==n&& [o=D[2],D=D[3..-1]]&& next; 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 them on global list L, in both cases print [least unused number] at the end. See the wiki page for more.

A329573 For all n >= 1, exactly 12 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 7; lexicographically earliest such sequence of distinct positive numbers.

Original entry on oeis.org

1, 2, 3, 4, 9, 10, 27, 14, 20, 33, 34, 69, 39, 28, 40, 13, 19, 70, 31, 43, 180, 220, 61, 36, 66, 91, 127, 7, 12, 5, 102, 186, 11, 6, 25, 18, 55, 41, 42, 48, 65, 72, 59, 38, 125, 24, 29, 35, 54, 32, 47, 77, 164, 26, 407, 15, 116, 63, 75, 404, 416, 8, 215, 45, 56, 183, 23, 134, 206, 17, 44, 50
Offset: 1

Views

Author

M. F. Hasler, Feb 09 2020

Keywords

Comments

That is, there are 12 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
This is the theoretical maximum: there can't be more than 12 primes in pairwise sums of 7 distinct numbers > 1. See the wiki page for more details.
Conjectured to be a permutation of the positive integers. See A329572 for the nonnegative variant (same definition but with n >= 0 and terms >= 0), leading to a quite different sequence.
For a(5) and a(6) one must forbid values up to 8 in order to be able to find a solution for a(7), but from then on, the greedy choice gives the correct solution, at least for several hundred terms. Small values appearing late are a(30) = 5, a(34) = 6, a(28) = 7, a(62) = 8.

Examples

			Up to and including the 6th term, there is no constraint other than not using a term more than once, since it is impossible to have more than 12 primes as pairwise sums of 6 numbers. So one would first try to use the lexicographically smallest possible choice a(1..6) =?= (1, 2, ..., 6). But then one would have only 7 pairs (i,j) such that a(i) + a(j) is prime, 1 <= i < j <= 6. So one would need 12 - 7 = 5 more primes in {1, 2, ..., 6} + a(7), which is impossible. One can check that even a(1..5) =?= (1,...,5) does not allow one to find a(6) and a(7) in order to have 12 prime sums a(i) + a(j), 1 <= i < j <= 7. Nor is it possible to find a solution with a(5) equal to 6 or 7 or 8. One finds that a(5) = 9, and a(6) = 10, are the smallest possible choices for which a(7) can be found as to satisfy the requirement. In that case, a(7) = 27 is the smallest possible solution, which yields the 12 prime sums 1+2, 2+3, 1+4, 3+4, 2+9, 4+9, 1+10, 3+10, 9+10, 2+27, 4+27, 10+27.
Now, to satisfy the definition of the sequence for n = 2, we drop the initial 1 from the set of consecutive terms, and search for a(8) producing the same number of additional primes together with {2, 3, 4, 9, 10, 27} as did a(1) = 1, namely 3. We see that a(8) = 14 is the smallest possibility. And so on.
It seems that once a(5) and a(6) are chosen, one may always take the smallest possible choice for the next term without ever again running into difficulty. This is in strong contrast to the (exceptional) case of the variant where we require 10 prime sums among 7 consecutive terms, cf. sequence A329574.
		

Crossrefs

Cf. A055272 (analog starting with a(0)=0), A055265 & A128280 (1 prime using 2 terms), A055266 & A253074 (0 primes using 2 terms), A329405 - A329416, A329425, A329333, A329449 - A329456, A329563 - A329581.

Programs

  • PARI
    {A329573(n,show=0,o=1,N=12,M=6,D=[5,9,6,10],p=[],u=o,U)=for(n=o+1,n, 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); D&& D[1]==n&& [o=D[2],D=D[3..-1]]&& next; 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 them on global list L, in both cases print [least unused number] at the end. See the wiki page for more.

A329564 For all n >= 0, exactly five sums are prime among a(n+i) + a(n+j), 0 <= i < j < 5; lexicographically earliest such sequence of distinct nonnegative numbers.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 8, 11, 7, 12, 29, 18, 19, 4, 13, 9, 22, 10, 21, 14, 57, 16, 15, 17, 26, 27, 20, 23, 33, 34, 38, 45, 25, 28, 51, 46, 31, 43, 58, 30, 24, 37, 49, 35, 36, 102, 47, 42, 55, 32, 41, 48, 65, 39, 62, 44, 40, 63, 69, 50, 68, 59, 80, 71, 54, 77, 60, 53, 56, 74, 75
Offset: 0

Views

Author

M. F. Hasler, Feb 09 2020

Keywords

Comments

That is, there are 5 primes, counted with multiplicity, among the 10 pairwise sums of any 5 consecutive terms.
Conjectured to be a permutation of the nonnegative integers.
If so, then the restriction to [1..oo) is a permutation of the positive integers, but not the smallest such, which is given in A329563. It seems that the two sequences have no common terms beyond a(6) = 8, except for the accidental a(22) = 15 and maybe some later coincidences of this type. There also appears to be no other simple relation between the terms of these sequences, in contrast to, e.g., A055265 vs. A128280. - M. F. Hasler, Feb 12 2020

Examples

			For n = 0, we consider pairwise sums among the first 5 terms a(0..4), among which we must have 5 primes. To get a(4), consider first a(0..3) = (0, 1, 2, 3) and the pairwise sums (a(i) + a(j), 0 <= i < j <= 3) = (1; 2, 3; 3, 4, 5) among which there are 4 primes, counted with multiplicity (i.e., the prime 3 is there two times). So the additional term a(4) must give exactly one more prime sum with all of a(0..3). We find that 4 or 5 would give two more primes, but a(4) = 6 gives exactly one more, 1 + 6 = 7.
Now, for n = 1 we forget the initial 0 and consider the pairwise sums of the remaining terms {1, 2, 3, 6}. There are 3 prime sums, so the next term must give two more. The term 4 would give two more (1+4 and 3+4) primes, but thereafter we would have {2, 3, 6, 4} with only 2 prime sums and impossibility to add one term to get three more prime sums: 2+x, 6+x and 4+x can't be all prime for x > 1.
Therefore 4 isn't the next term, and we try a(5) = 5 which indeed gives the required number of primes, and also allows us to continue.
		

Crossrefs

Cf. A329425 (6 primes using 5 consecutive terms).
Cf. A055266 & A253074 (0 primes using 2 terms), A329405 & A329450 (0 primes using 3 terms), A055265 & A128280 (1 prime using 2 terms), A329333, A329406 - A329410 (1 prime using 3, ..., 10 terms), A329411 - A329416 and A329452, A329453 (2 primes using 3, ..., 10 terms), A329454 & A329455 (3 primes using 4 resp. 5 terms), A329449 & A329456 (4 primes using 4 resp. 5 terms), A329568 & A329569 (9 primes using 6 terms), A329572 & A329573 (12 primes using 7 terms), A329563 - A329581: other variants.

Programs

  • PARI
    {A329564(n,show=1,o=0,N=5,M=4,X=[[4,4]],p=[],u,U)=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])))); if(#p
    				

A329574 For every n >= 0, exactly 10 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 7; lexicographically earliest such sequence of distinct nonnegative numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 8, 9, 10, 14, 33, 15, 20, 27, 26, 11, 32, 16, 41, 21, 57, 116, 22, 51, 38, 23, 50, 63, 86, 6, 17, 24, 77, 65, 18, 13, 114, 25, 36, 28, 35, 43, 12, 31, 61, 66, 40, 19, 47, 42, 90, 241, 7, 52, 37, 34, 45, 30, 55, 49, 394, 58, 73, 39, 48, 64, 109, 115
Offset: 0

Views

Author

M. F. Hasler, Feb 10 2020

Keywords

Comments

That is, there are 10 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
Conjectured to be a permutation of the nonnegative integers.
If it is, then the restriction to [1..oo) is a permutation of the positive integers, but maybe not the lexicographically earliest one with this property.
This is the first example of a sequence of this type for which the greedy choice of a(n) is frequently incorrect beyond the initial terms, see Examples.

Examples

			At the beginning of the sequence, we must avoid the choice of 6 or 7 for a(6): both appear to be possible at first sight, giving exactly 10 prime sums with n = 0 in the definition, but then make it impossible to find a successor term a(7) for which the definition is satisfied with n = 1.
The same happens again for a(37) and a(58), where the apparently possible value 19 resp. 46 must be avoided.
		

Crossrefs

Cf. A055265, A128280 (1 prime from 2 terms), A329333 (1 prime from 3 terms), A329405, ..., A329416 (N primes from M terms >= 1), A329425, A329449, ..., A329581 (N primes from M terms >= 0).

Programs

  • PARI
    {A329574(n, show=0, o=0, N=10, M=6, X=[[6,6],[6,7],[37,19],[58,46]], p=[], u=o, U)=for(n=o+1, n, 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|x<-p, isprime(x+k)], #p>=M)|| setsearch(X, [n, k])|| [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. Parameters N, M, o, ... allow getting other variants, see the wiki page for more.
Showing 1-10 of 13 results. Next