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.

Previous Showing 11-20 of 39 results. Next

A055266 a(n) + a(n+1) is never prime; lexicographically earliest such sequence of distinct positive integers.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

See A253074 for an essentially identical sequence (with a proof that the sequence is a permutation).
Sequence A253074 is defined in the same way, but starting with 0. This happens to produce the same sequence from the next term on. This is the case (M,N) = (2,0) in the family of sequences where M consecutive terms yield N primes in their pairwise sums, see the wiki page for other examples. - M. F. Hasler, Nov 26 2019

Examples

			a(3) = 5 because 1 and 3 have already been used and both 3 + 2 = 5 and 3 + 4 = 7 are prime while 3 + 5 = 8 is not prime.
		

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a055266 n = a055266_list !! (n-1)
    a055266_list = 1 : f 1 [2..] where
       f u vs = g vs where
         g (w:ws) | a010051' (u + w) == 0 = w : f w (delete w vs)
                  | otherwise = g ws
    -- Reinhard Zumkeller, Jan 14 2015
    
  • Maple
    N:= 1000; # to get a[n] for n up to N
    A:= {1};
    a[1]:= 1;
    for n from 2 to N do
      mA:= max(A);
      R:= {$1..mA} minus A;
      for x in R do
         if not isprime(a[n-1]+x) then
           a[n]:= x;
           break
         fi
       od:
       if not assigned(a[n]) then
         for x from mA+1 do
           if not isprime(a[n-1]+x) then
             a[n]:= x;
             break
           fi
         od
       fi;
       A:= A union {x};
    od:
    seq(a[n],n=1..N); # Robert Israel, Jun 03 2014
  • Mathematica
    f[ s_ ]:=Block[ {k=1,a=s[ [ -1 ] ]},While[ Or[ MemberQ[ s,k ],PrimeQ[ a+k ] ],k++ ];Append[ s,k ] ];Nest[ f,{1},121 ] (* Zak Seidov, Oct 21 2009 *)
    a={1};z=Range[2,2002];z=Complement[z,a];While[Length[z]>1,If[!PrimeQ[z[[1]]+Last[a]],AppendTo[a,z[[1]]],If[!PrimeQ[z[[2]]+Last[a]],AppendTo[a,z[[2]]],AppendTo[a,z[[3]]]]];z=Complement[z,a]];Print[a] (* significantly faster *) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
  • PARI
    v=[1]; n=1; while(n<100, if(!isprime(n+v[#v])&&!vecsearch(vecsort(v), n), v=concat(v, n); n=0); n++); v \\ Derek Orr, Jun 08 2015
    
  • PARI
    A055266_upto(n=99, u=1, U, a)={vector(n, n, n=u; while(bittest(U, n-u)|| isprime(a+n), n++); if(n>u, U+=1<<(n-u), U>>=-u+u+=valuation(U+2, 2)); a=n) + if(default(debug), print([u]))} \\ Optional args allow to tweak computation. If debug > 0, print least unused number at the end. - M. F. Hasler, Nov 25 2019

Formula

a(n) = A253074(n+1) (as long as A253074(1) = 0). - M. F. Hasler, Nov 26 2019

Extensions

Corrected by Zak Seidov, Oct 21 2009
Name edited by M. F. Hasler, Nov 26 2019

A128280 a(n) is the least number not occurring earlier such that a(n)+a(n-1) is prime, a(0) = 0.

Original entry on oeis.org

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

Views

Author

Zak Seidov, May 03 2007

Keywords

Comments

Original definition: start with a(1) = 2. See A055265 for start with a(1) = 1.
The sequence may well be a rearrangement of natural numbers. Interestingly, subsets of first n terms are permutations of 1..n for n = {2, 4, 8, 10, 18, 22, 24, 56, ...}. E.g., first 56 terms: {2, 1, 4, 3, 8, 5, 6, 7, 10, 9, 14, 15, 16, 13, 18, 11, 12, 17, 20, 21, 22, 19, 24, 23, 30, 29, 32, 27, 26, 33, 28, 25, 34, 37, 36, 31, 40, 39, 44, 35, 38, 41, 42, 47, 50, 51, 46, 43, 54, 49, 48, 53, 56, 45, 52, 55} are a permutation of 1..56.
Without altering the definition nor the existing values, one can as well start with a(0) = 0 and get (conjecturally) a permutation of the nonnegative integers. This sequence is in some sense the "arithmetic" analog of the "digital" variant A231433: Here we add subsequent terms, there the digits are concatenated. - M. F. Hasler, Nov 09 2013
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 A329333, A329405 ff, A329449 ff and the OEIS Wiki page. - M. F. Hasler, Nov 24 2019

Crossrefs

Cf. A083236.
Cf. A055265 for the variant starting with a(1) = 1, and A329333, A329405, ..., A329425 and A329449, ..., A329581 for other variants. - M. F. Hasler, Nov 24 2019

Programs

  • PARI
    {a=0;u=0; for(n=1, 99, u+=1<
    				

Formula

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

Extensions

Initial a(0) = 0 prefixed by M. F. Hasler, Nov 09 2013

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

A088643 Triangle read by rows: row n >= 1 is obtained as follows. Start with n, next term is always largest number m with 1 <= m < n which has not yet appeared in that row and such that m + previous term in the row is a prime. Stop when no further m can be found.

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 2, 3, 4, 1, 6, 5, 2, 3, 4, 1, 7, 6, 5, 2, 3, 4, 1, 8, 5, 6, 7, 4, 3, 2, 1, 9, 8, 5, 6, 7, 4, 3, 2, 1, 10, 9, 8, 5, 6, 7, 4, 3, 2, 1, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1, 12, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1, 13, 10, 9, 8, 11, 12, 7, 6, 5, 2, 3, 4, 1, 14, 9, 10, 13, 6, 11, 12, 7, 4, 3, 8, 5, 2, 1
Offset: 1

Views

Author

N. J. A. Sloane, Nov 24 2003

Keywords

Comments

It is conjectured that row n is always a permutation of {1..n}. This has been verified for n <= 400000.
Presumably many of the rows, when read from right to left, match the infinite sequence A055265. [But see a more precise comment that follows. - N. J. A. Sloane, Aug 14 2021]
I conjecture that almost all rows have exactly 7 (but not more) trailing terms in common with the initial terms of A055265 = (1, 2, 3, 4, 7, 6, 5, 8, ...): After row 10 whose reversal matches the first 10 terms of A055265, and rows n = 14, 15 and 16 having the last 2 (but not 3) terms equal to A055265(1..2), all rows up to n = 500 have either (about 25%) exactly 1 or (about 73%) exactly 7 trailing terms equal to the first terms of A055265. Between n = 501 and n = 10000 and beyond, all rows end in (..., 9, 14, 5, 6, 7, 4, 3, 2, 1), so they all have exactly m = 7 but not m = 8 trailing terms equal to A055265(1..m). - M. F. Hasler, Aug 03 2021
In fact, the reversed rows converge to the different sequence A132075, essentially defined by this property. - M. F. Hasler, Aug 04 2021
It seems we do not know of a proof (1) that the sequence of reversed rows of this sequence converges or (2) that A132075 is infinite; or that either statement implies the other. The reversed rows converge to A132075 if both statements are true, as suggested empirically by the early rows of this sequence. - Peter Munn, Nov 19 2021

Examples

			For example, the 20th row is 20, 17, 14, 15, 16, 13, 18, 19, 12, 11, 8, 9, 10, 7, 6, 5, 2, 3, 4, 1.
Triangle begins:
  1;
  2, 1;
  3, 2, 1;
  4, 3, 2, 1;
  5, 2, 3, 4, 1;
  6, 5, 2, 3, 4, 1;
  (...)
		

Crossrefs

A088631 and A088861 give second and third columns.

Programs

  • Haskell
    import Data.List (delete)
    a088643_tabl = map a088643_row [1..]
    a088643 n k = a088643_row n !! (k-1)
    a088643_row n = n : f n [n-1, n-2 .. 1] where
       f u vs = g vs where
         g []                            = []
         g (x:xs) | a010051 (x + u) == 1 = x : f x (delete x vs)
                  | otherwise            = g xs
    -- Reinhard Zumkeller, Jan 05 2013
    
  • Maple
    A088643 := proc(n,k)
        option remember ;
        local m,c;
        if n = 1 then
            1;
        else
            if k = 1 then
                return n;
            else
                for m from n-1 to 1 by -1 do
                    if not member(m,[seq(procname(n,c),c=1..k-1)]) then
                        if isprime(m+procname(n,k-1)) then
                            return m;
                        end if ;
                    end if;
                end do:
            end if;
        end if;
    end proc:
    for n from 1 to 10 do
    for k from 1 to n do
        printf("%d ",A088643(n,k)) ;
    end do:
    printf("\n") ;
    end do: # R. J. Mathar, Aug 18 2021
  • Mathematica
    t[n_, 1] := n; t[n_, k_] := t[n, k] = For[m = n-1, m >= 1, m--, If[ PrimeQ[m + t[n, k-1] ] && FreeQ[ Table[ t[n, j], {j, 1, k-1} ], m], Return[m] ] ]; Table[ t[n, k], {n, 1, 14}, {k, 1, n} ] // Flatten (* Jean-François Alcover, Apr 03 2013 *)
  • PARI
    apply( {A088643_row(n, t=List(-[1-n..-1]))=vector(n,i, i>1 && for(j=1,#t, isprime(n+t[j]) && [n=t[j], listpop(t,j), break]);n)}, [1..20]) \\ M. F. Hasler, Aug 02 2021; improved Aug 03 2021 after PARI below
    
  • PARI
    row(n) = { my(res = vector(n), todo = List([1..n-1])); res[1] = n; for(i = 1, n - 1, forstep(j = #todo, 1, -1, if(isprime(res[i] + todo[j]), res[i+1] = todo[j]; listpop(todo, j); next(2) ) ) ); res } \\ David A. Corneth, Aug 02 2021

Formula

A255313(n,k) = T(n,k-1) + T(n,k), n > 0 and 1 <= k <= n. - Reinhard Zumkeller, Feb 22 2015

Extensions

More terms from David Wasserman, Aug 16 2005

A054408 a(n) = smallest positive integer not already in sequence such that the partial sum a(1)+...+a(n) is prime.

Original entry on oeis.org

2, 1, 4, 6, 10, 8, 12, 16, 14, 24, 30, 22, 18, 26, 34, 36, 20, 28, 38, 40, 32, 42, 46, 48, 44, 52, 56, 60, 54, 58, 66, 50, 64, 62, 70, 84, 90, 72, 92, 76, 86, 94, 74, 88, 68, 82, 80, 102, 96, 100, 114, 98, 78, 112, 120, 110, 108, 106, 126, 122, 130, 132, 134, 124, 128, 118
Offset: 1

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

1 is the only odd number in this sequence. - Derek Orr, Feb 07 2015
Conjecture: Every even numbers appears. - N. J. A. Sloane, May 29 2017

Crossrefs

Cf. A254337.
See A073659 for another version.
In A055265 only pairs of adjacent terms add to primes.

Programs

  • Mathematica
    t = {2}; Do[i = 1; While[! PrimeQ[Total[t] + i] || MemberQ[t, i], i++]; AppendTo[t, i], {65}]; t (* Jayanta Basu, Jul 04 2013 *)
  • PARI
    v=[2];n=1;while(n<100,if(isprime(vecsum(v)+n)&&!vecsearch(vecsort(v),n),v=concat(v,n);n=0);n++);v \\ Derek Orr, Feb 07 2015
    
  • Python
    from sympy import isprime
    def aupton(terms):
        alst, aset, asum = [], set(), 0
        while len(alst) < terms:
            an = 1
            while True:
                while an in aset: an += 1
                if isprime(asum + an):
                    alst, aset, asum = alst + [an], aset | {an}, asum + an
                    break
                an += 1
        return alst
    print(aupton(66)) # Michael S. Branicky, Jun 05 2021

A051237 Lexicographically earliest prime pyramid, read by rows.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 4, 3, 2, 5, 1, 4, 3, 2, 5, 6, 1, 4, 3, 2, 5, 6, 7, 1, 2, 3, 4, 7, 6, 5, 8, 1, 2, 3, 4, 7, 6, 5, 8, 9, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 12, 1, 2, 3, 4, 7, 6, 5, 12, 11, 8, 9, 10, 13, 1, 2, 3, 4, 7, 6, 13, 10
Offset: 1

Views

Author

Keywords

Comments

Row n begins with 1, ends with n and sum of any two adjacent entries is prime.
From Daniel Forgues, May 17 2011 and May 18 2011: (Start)
Since the sum of any two adjacent entries is at least 3, the sum is an odd prime, which implies that any two consecutive entries have opposite parity.
Since the first and last entries of row n are fixed at 1 and n, we have to find n-2 entries, where ceiling((n-2)/2) of them are even and floor((n-2)/2) are odd, so for row n the number of possible arrangements is
(ceiling((n-2)/2))! * (floor((n-2)/2))! (Cf. A010551(n-2), n >= 2.)
The number of ways of arranging row n to get a prime pyramid is given by A036440. List them in lexicographic order and pick the first (earliest) to get row n of lexicographically earliest prime pyramid.
Prime pyramids are also (more fittingly?) called prime triangles. (End)
It appears that the limit of the rows of the lexicographically earliest prime pyramid is A055265 (see comment in that sequence).
Assuming Dickson's conjecture (or the later Hardy-Littlewood Conjecture B), no backtracking is needed: if the first n-2 elements in each row are chosen greedily, a penultimate member can be chosen such that its sums are prime. - Charles R Greathouse IV, May 18 2011

Examples

			Triangle begins:
1;
1, 2;
1, 2, 3;
1, 2, 3, 4;
1, 4, 3, 2, 5;
1, 4, 3, 2, 5, 6;
1, 4, 3, 2, 5, 6, 7;
1, 2, 3, 4, 7, 6, 5, 8;
1, 2, 3, 4, 7, 6, 5, 8, 9;
1, 2, 3, 4, 7, 6, 5, 8, 9, 10;
1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11;
1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 12;
1, 2, 3, 4, 7, 6, 5, 12, 11, 8, 9, 10, 13;
		

References

  • R. K. Guy, Unsolved Problems Number Theory, Section C1.

Crossrefs

See A187869 for the concatenation of the numbers for each row.

Programs

  • Mathematica
    (* first do *) Needs["Combinatorica`"] (* then *) f[n_] := Block[{r = Range@ n}, While[ Union[ PrimeQ[ Plus @@@ Partition[r, 2, 1]]][[1]] == False, r = NextPermutation@ r]; r]; f[1] = 1; Array[f, 13] // Flatten (* Robert G. Wilson v *)

Extensions

More terms from Jud McCranie

A329566 For all n >= 0, exactly six 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, 3, 4, 24, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 28, 31, 17, 15, 14, 22, 26, 20, 21, 27, 23, 30, 32, 80, 41, 38, 51, 39, 62, 29, 35, 44, 34, 45, 54, 25, 49, 33, 64, 36, 37, 40, 46, 61, 47, 42, 43, 55, 66, 58, 65, 48, 72, 79, 52, 53, 59, 78, 50, 57, 60, 89, 71, 56, 68, 63, 74, 75, 76, 69, 82, 81, 67, 91, 88, 70, 100
Offset: 0

Views

Author

M. F. Hasler, Nov 17 2019

Keywords

Comments

That is, there are 6 primes, counted with multiplicity, among the 15 pairwise sums of any 6 consecutive terms.
Is this a permutation of the nonnegative integers?
If so, then the restriction to [1..oo) is a permutation of the positive integers, but not the lexicographically earliest one with this property, which starts (1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 24, ...).

Examples

			For n = 0, we consider pairwise sums of the first 6 terms a(0..5) = (0, 1, 2, 3, 4, 24): We have (a(i) + a(j), 0 <= i < j < 6) = (1; 2, 3; 3, 4, 5; 4, 5, 6, 7; 24, 25, 26, 27, 28) among which there are 6 primes, counted with repetition. This justifies taking a(0..4) = (0, ..., 4), the smallest possible choices for these first 5 terms. Since no smaller a(5) between 5 and 23 has this property, this is the start of the lexicographically earliest nonnegative sequence with this property and no duplicate terms.
Then we find that a(6) = 5 is possible, also giving 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 we find that a(7) = 6 is not possible, it would give only 5 prime sums using the 6 consecutive terms (2, 3, 4, 24, 5, 6). However, a(7) = 7 is a valid continuation, and so on.
		

Crossrefs

Cf. A329425 (6 primes using 5 consecutive terms).
Cf. A329449 (4 primes using 4 consecutive terms), A329456 (4 primes using 5 consecutive terms).
Cf. A329454 (3 primes using 4 consecutive terms), A329455 (3 primes using 5 consecutive terms).
Cf. A329411 (2 primes using 3 consecutive terms), A329452 (2 primes using 4 consecutive terms), A329453 (2 primes using 5 consecutive terms).
Cf. A329333 (1 (odd) prime using 3 terms), A128280 & A055265 (1 prime using 2 terms); A055266 & A253074 (0 primes using 2 terms), A329405 & A329450 (0 primes using 3 terms), A329406 ff: other variants.

Programs

  • PARI
    A329566(n,show=0,o=0,N=6,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
    				

A073659 a(1) = 1; for n > 1, a(n) is the smallest even number not already in the sequence such that a(1) + ... + a(n) is a prime.

Original entry on oeis.org

1, 2, 4, 6, 10, 8, 12, 16, 14, 24, 30, 22, 18, 26, 34, 36, 20, 28, 38, 40, 32, 42, 46, 48, 44, 52, 56, 60, 54, 58, 66, 50, 64, 62, 70, 84, 90, 72, 92, 76, 86, 94, 74, 88, 68, 82, 80, 102, 96, 100, 114, 98, 78, 112, 120, 110, 108, 106, 126, 122, 130, 132, 134, 124, 128, 118
Offset: 1

Views

Author

Amarnath Murthy, Aug 10 2002

Keywords

Comments

Essentially the same as A054408. - R. J. Mathar, Dec 15 2008
Conjecture: Every even number appears. - N. J. A. Sloane, May 29 2017

Crossrefs

See A055265 for a version where the sums of two adjacent terms are primes.

Programs

  • Mathematica
    t = {1}; Do[i = 2; While[! PrimeQ[Total[t] + i] || MemberQ[t, i], i += 2]; AppendTo[t, i], {65}]; t (* Jayanta Basu, Jul 04 2013 *)
  • PARI
    v=[1];n=1;while(n<200,if(isprime(n+vecsum(v))&&!vecsearch(vecsort(v),n),v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 01 2015

Extensions

More terms from Sascha Kurz, Jan 28 2003
Offset corrected by Chai Wah Wu, Aug 27 2017

A076990 a(1) = 1, a(2) = 2; thereafter a(n) = smallest number not occurring earlier such that the sum of three successive terms is prime.

Original entry on oeis.org

1, 2, 4, 5, 8, 6, 3, 10, 16, 11, 14, 12, 15, 20, 18, 9, 26, 24, 17, 30, 32, 21, 36, 22, 13, 38, 28, 7, 44, 46, 19, 42, 40, 25, 48, 34, 27, 52, 58, 29, 50, 60, 39, 64, 54, 31, 66, 70, 37, 56, 74, 33, 72, 62, 23, 78, 80, 35, 76, 68, 47, 82, 94, 51, 84, 88, 55, 86, 92, 45, 90, 98
Offset: 1

Views

Author

Amarnath Murthy, Oct 25 2002

Keywords

Comments

a(n) = n only for n: 1, 2, 6, 12 for all n < 10000. - Robert G. Wilson v, Nov 21 2012
a(n) = ~(1 +- 2/5)*n. - Robert G. Wilson v, Nov 21 2012
a(n) is odd if and only if n == 1 (mod 3). - Robert Israel, Dec 09 2015
The odd terms grow according to a(3k+1) ~ 2k and the even terms according to a(n) ~ 4n/3. - M. F. Hasler, Dec 11 2015

Examples

			After 8 and 6 the next term is 3 as 8+6+3 = 17 is a prime.
		

Crossrefs

See also A055265.

Programs

  • Maple
    N:= 200: # to get all terms before the first > N
    V:= Vector(N):
    V[1]:= 1: V[2]:= 1:
    A[1]:= 1: A[2]:= 2:
    m0:= 3: m:= 0:
    for n from 3 while m <= N do
       t:= A[n-1]+A[n-2];
       m1:= m0 + (m0+t+1 mod 2);
       for m from m1 to N by 2 do if isprime(m+t) and V[m] = 0 then
           A[n]:= m;
           V[m]:= 1;
           break;
       fi od:
       if m = m0 then
           while m0 < N and V[m0] = 1  do m0:= m0+1 od:
       fi;
    od:
    seq(A[j],j=1..n-2); # Robert Israel, Dec 09 2015
  • Mathematica
    f[s_List] := Block[{p = s[[-2]] + s[[-1]], q = 1}, While[ !PrimeQ[p + q] || MemberQ[s, q], q++]; Append[s, q]]; Nest[f, {1, 2}, 70] (* Robert G. Wilson v, Nov 21 2012 *)
  • PARI
    A076990(n,verbose=0/*=1 to print all terms*/,a=1,u=0,m=1,L=0)={for(i=2,n,verbose&&print1(a",");u+=1<M. F. Hasler, Dec 11 2015

Extensions

More terms from David Garber, Oct 30 2002
Previous Showing 11-20 of 39 results. Next