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 18 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

A329333 There is exactly one odd prime among the pairwise sums of any three consecutive terms: Lexicographically earliest sequence of distinct nonnegative integers with this property.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is conjectured and designed to be a permutation of the nonnegative integers, therefore the offset is taken to be zero.
Restricted to positive indices, this is a sequence of positive integers having the same property, then conjectured to be a permutation of the positive integers. (The word "odd" can be omitted in this case.)
If the word "odd" is dropped from the original definition, the sequence starts (0, 1, 3, 6, 2, 7), and then continues from a(6) = 4 onward as the present sequence. This is again conjectured to be a permutation of the nonnegative integers, and a permutation of the positive integers when restricted to the domain [1..oo). The latter however no longer has the property of lexicographic minimality.
See the OEIS wiki page for further considerations about existence, surjectivity and variants. - M. F. Hasler, Nov 24 2019

Examples

			For the first two terms there is no restriction regarding primality, so a(0) = 0, a(1) = 1. (If only positive values and indices are considered, then a(1) = 1 and a(2) = 2.)
Then a(2) must be such that among { 0+1, 0+a(2), 1+a(2) } there is exactly one odd prime, and 2 works.
Then a(3) must be such that among { 1+2, 1+a(3), 2+a(3) } there is only one (odd) prime. Since 1+2 = 3, the other two sums must both yield a composite. This excludes 3, 4, 5 and 6 and the smallest possibility is a(3) = 7.
And so on.
		

Crossrefs

For the primes that arise, or are missing, see A328997, A328998.
See A329450 for the variant having 0 primes among a(n+i) + a(n+j), 0 <= i < j < 3.
See A329452 for the variant having 2 primes among a(n+i) + a(n+j), 0 <= i < j < 4.
A084937, A305369 have comparable conditions on three consecutive terms.

Programs

  • Mathematica
    a[0]=0;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]!=1||MemberQ[Array[a,n-1,0],k]];k);Array[a,100,0] (* Giorgos Kalogeropoulos, May 07 2021 *)
  • PARI
    A329333(n,show=0,o=0,p=0,U=[])={for(n=o,n-1, show&&print1(o","); U=setunion(U,[o]); while(#U>1&&U[1]==U[2]-1,U=U[^1]); for(k=U[1]+1,oo, setsearch(U,k)|| if(isprime(o+p), isprime(o+k)|| isprime(p+k), isprime(o+k)==isprime(p+k)&&p)||[o&&p=o, o=k, break]));o} \\ Optional args: show = 1: print all values up to a(n); o = 1: start with a(1) = 1; p = 1: compute the variant with a(2) = 3. See the wiki page for more general code which returns the whole vector: Use S(n_max,1,3,1) or S(n_max,1,3,2,[0,1]); S(n_max,1,3,0) gives the variant (0, 1, 3, ...)

Extensions

Entry revised by N. J. A. Sloane, Nov 14 2019 and M. F. Hasler, Nov 15 2019

A329449 For any n >= 0, exactly four sums a(n+i) + a(n+j) are prime, for 0 <= i < j <= 3: lexicographically earliest such sequence of distinct nonnegative integers.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, based on an idea from Eric Angelini, Nov 15 2019

Keywords

Comments

That is, there are exactly four primes (counted with multiplicity) among the 6 pairwise sums of any four consecutive terms. This is the theoretical maximum: there can't be a sequence with more than 4 prime sums in any 4 consecutive terms, see the wiki page for details.
This map is defined with offset 0 as to have a permutation of the nonnegative integers in case each of these eventually appears, which is so far only conjectured, see below. The restriction to positive indices would then be a permutation of the positive integers, and as it happens, also the smallest one with the given property. (This is in contrast to most other cases where that one is not the restriction of the other one: see crossrefs).
Concerning the existence of the sequence with infinite length: If the sequence is to be computed in a greedy manner, this means that for given P(n) := {a(n-1), a(n-2), a(n-3)} and thus 0 <= N(n) := #{ primes x + y with x, y in P(n), x < y} <= 4, we have to find a(n) such that we have exactly 4 - N(n) primes in a(n) + N(n). It is easy to prove that this is always possible when 4 - N(n) = 0 or 1. Otherwise, similar to A329452, ..., A329456, we see that P(n) is an "admissible constellation" in the sense that a(n-4) + P(n) already gave the number of primes required now. So a weaker variant of the k-tuple conjecture would ensure we can find this a(n). But the sequence need not be computable in greedy manner! That is, if ever for given P(n) no a(n) would exist such that a(n) + P(n) contains 4 - N(n) primes, this simply means that the considered value of a(n-1) (and possibly a(n-2)) was incorrect, and the next larger choice has to be made. Given this freedom, there is no doubt that this sequence is well defined up to infinity.
Concerning surjectivity: If a number m would never appear, this means that m + P(n) will never have the required number of 4 - N(n) primes for all n with a(n) > m, in spite of having found for each of these n at least two other solutions, a(n-4) + P(n) and a(n) + P(n) which both gave 4 - N(n) primes. This appears extremely unlikely and thus as strong evidence in favor of surjectivity.
See examples for further computational evidence.

Examples

			We start with a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 3, the smallest possibilities which do not lead to a contradiction. Indeed, the four sums 0 + 2, 0 + 3, 1 + 2 and 2 + 3 are prime.
Now we have 2 prime sums using {1, 2, 3}, so the next term must give two more prime when added to these. We find that a(4) = 4 is the smallest possible choice, with 1 + 4 = 5 and 3 + 4 = 7.
Then there are again 2 primes among the pairwise sums using {2, 3, 4}, so the next term must again produce two more prime sums. We find that a(5) = 9 is the smallest possibility, with 2 + 9 = 11 and 4 + 9 = 13.
a(10^4) = 9834 and all numbers up to 9834 occurred by then.
a(10^5) = 99840 and all numbers below 99777 occurred by then.
a(10^6) = 1000144 and all numbers below 999402 occurred by then.
		

Crossrefs

Other sequences with N primes among pairwise sums of M consecutive terms, starting with a(o) = o, sorted by decreasing N and lowest possible M: A329581 (N=11, M=8, o=0), A329580 (N=10, M=8, o=0), A329569 (N=9, M=6, o=0), A329568 (N=9, M=6, o=1), A329425 (N=6, M=5, o=0), A329449 (N=4, M=4, o=0), A329411 (N=2, M=3, o=0 or 1), A128280 (N=1, M=2, o=0), A055265 (N=1, M=2, o=1), A055266 (N=0, M=2; o=1), A253074 (N=0, M=2; o=0).
For other variants see A329333 (N=1, M=3; o=0/1), A329405 (0,3;1) .. A329417 (3,4;1), A329449 (4,4;0) .. A329580 (10,8;0).

Programs

  • PARI
    A329449(n, show=0, o=0, N=4, M=3, 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])))); 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=1: start with a(1)=1; N, M: get N primes using M+1 consecutive terms.

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

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
    				

A257218 Lexicographically earliest sequence of distinct positive integers such that gcd(a(n), a(n-1)) takes no value more than twice.

Original entry on oeis.org

1, 2, 3, 6, 4, 8, 10, 5, 15, 9, 18, 12, 16, 24, 30, 20, 40, 32, 48, 36, 27, 54, 72, 60, 45, 75, 25, 50, 70, 7, 14, 28, 42, 21, 63, 126, 84, 56, 112, 64, 96, 120, 80, 100, 150, 90, 108, 81, 162, 216, 144, 168, 140, 35, 105, 210, 180, 135, 225, 300
Offset: 1

Views

Author

Ivan Neretin, Apr 18 2015

Keywords

Comments

Presumably a(n) is a permutation of the positive integers.
Primes seem to occur in their natural order. 31 appears as a(7060). Primes p >= 37 are not found among the first 10000 terms.
Numbers n such that a(n)=n are 1, 2, 3, 12, 306, ...
A256918(n) = gcd(a(n), a(n+1)); gcd(a(A257120(n)), a(A257120(n)+1)) = gcd(a(A257475(n)), a(A257475(n)-1)) = n. - Reinhard Zumkeller, Apr 25 2015
For p prime: A257122(p)-1 = index of the smallest multiple of p: a(A257122(p)-1) mod p = 0 and a(m) mod p > 0 for m < A257122(p)-1. - Reinhard Zumkeller, Apr 26 2015

Examples

			After a(9)=15, the values 1, 2, 3, 4, 6, and 8 are already used, while 7 is forbidden because gcd(15,7)=1 and that value of GCD has already occurred twice, at (1,2) and (2,3). The minimal value which is neither used not forbidden is 9, so a(10)=9.
		

Crossrefs

Other minimal sequences of distinct positive integers that match some condition imposed on a(n) and a(n-1):
A175498 (differences are unique),
A081145 (absolute differences are unique),
A235262 (bitwise XORs are unique),
A163252 (differ by one bit in binary),
A000027 (GCD=1),
A064413 (GCD>1),
A128280 (sum is a prime),
A034175 (sum is a square),
A175428 (sum is a cube),
A077220 (sum is a triangular number),
A073666 (product plus 1 is a prime),
A081943 (product minus 1 is a prime),
A091569 (product plus 1 is a square),
A100208 (sum of squares is a prime).
Cf. A004526.
Cf. A256918, A257120, A257475, A257478, A257122 (putative inverse).
Cf. also A281978.

Programs

  • Haskell
    import Data.List (delete); import Data.List.Ordered (member)
    a257218 n = a257218_list !! (n-1)
    a257218_list = 1 : f 1 [2..] a004526_list where
       f x zs cds = g zs where
         g (y:ys) | cd `member` cds = y : f y (delete y zs) (delete cd cds)
                  | otherwise       = g ys
                  where cd = gcd x y
    -- Reinhard Zumkeller, Apr 24 2015
  • Mathematica
    a={1}; used=Array[0&,10000]; Do[i=1; While[MemberQ[a,i] || used[[l=GCD[a[[-1]],i]]]>=2, i++]; used[[l]]++; AppendTo[a,i], {n,2,100}]; a (* Ivan Neretin, Apr 18 2015 *)

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

Original entry on oeis.org

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

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 positive integers.
This sequence is quite different from the restriction of the "nonnegative" variant A329564 to positive indices: it seems that the two 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.

Examples

			For n = 1, we consider pairwise sums among the first 5 terms chosen as small as possible, a(1..5) = (1, 2, 3, 4, 5). We see that we have indeed 5 primes among the sums 1+2, 1+3, 1+4, 1+5, 2+3, 2+4, 2+5, 3+4, 3+5, 4+5.
Then, to get a(6), consider first the pairwise sums among terms a(2..5), (2+3, 2+4, 2+5; 3+4, 3+5; 4+5), among which there are 3 primes, counted with multiplicity (i.e., the prime 7 is there two times). So the new term a(6) must give exactly two more prime sums with the terms a(2..5). We find that 6 or 7 would give just one more (5+6 resp. 4+7), but a(6) = 8 gives exactly two more, 3+8 and 5+8.
		

Crossrefs

Cf. A329425 (6 primes using 5 consecutive terms), A329566 (6 primes using 6 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
    {A329563(n,show=1,o=1,N=5,M=4,p=[],u=o,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
    				

A231433 The digits of a(n) and a(n+1) taken together are the digits of a prime; least permutation of the nonnegative integers with this property.

Original entry on oeis.org

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

Views

Author

Eric Angelini and M. F. Hasler, Nov 09 2013

Keywords

Comments

The offset is zero to have a permutation.
Sequence A128280 is an "arithmetic" analog, where instead of concatenation of digits, the terms are added.
Sequences A228407 and A228410 are the variants where "prime" is replaced by "palindrome".

Examples

			Start with a(0)=0. The least prime having this digit is 101, so a(1)=11. Since 0 cannot be used any more and 111 is not a prime, the least digit that can be added to get the digits of some prime (namely 211) is a(2)=2, then a(3)=3 yields 23, etc.
See also the link to Angelini's post.
		

Programs

  • PARI
    {a=u=0;for(n=1,99,u+=1<"0"&&(a=k)&&next(3))))}

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

Original entry on oeis.org

1, 2, 3, 9, 4, 10, 27, 14, 33, 57, 26, 40, 87, 50, 21, 63, 16, 20, 51, 8, 81, 93, 46, 56, 15, 58, 135, 183, 28, 44, 39, 88, 69, 123, 34, 68, 105, 128, 45, 129, 22, 52, 141, 38, 75, 159, 32, 82, 99, 64, 117, 147, 80, 94, 177, 116, 237, 273, 74, 100, 387, 76, 207, 357, 62, 104, 165, 86, 77, 95
Offset: 1

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 number of possible prime sums for any set of 6 numbers > 1, see wiki page for details.
Conjectured to be a permutation of the positive integers. See A329569 = (0, 1, 2, 5, 6, 11, 12, 17, ...) for the quite different variant for nonnegative integers.
For n > 6, 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) "was wrong and must be corrected", so to say.) See the wiki page for further considerations about existence and surjectivity.
For a(4), one must exclude the values {4, ..., 8} to get an infinite sequence, but for all other (at least several hundred) terms, the greedy choice gives the correct solution.

Crossrefs

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

Programs

  • PARI
    {A329568(n,show=0,o=1,N=9,M=5,X=[[4,x]|x<-[4..8]],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 18 results. Next