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-3 of 3 results.

A256212 Indices of prime terms in A255004.

Original entry on oeis.org

2, 3, 5, 7, 9, 11, 13, 15, 19, 20, 22, 23, 27, 29, 31, 33, 39, 41, 43, 47, 49, 52, 55, 57, 58, 62, 63, 65, 67, 68, 72, 73, 74, 77, 79, 80, 86, 91, 92, 93, 95, 96, 99, 101, 102, 103, 110, 111, 113, 115, 118, 123, 124, 127, 129, 131, 134, 137
Offset: 1

Views

Author

N. J. A. Sloane, Mar 26 2015

Keywords

Comments

It would be nice to have a definition of this sequence which is independent of A255004.

Crossrefs

Cf. A255004.

A257728 Permutation of natural numbers: a(1)=1; a(2n) = not_an_oddprime(1+a(n)), a(2n+1) = oddprime(a(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 11, 9, 13, 10, 17, 12, 19, 14, 23, 18, 37, 15, 29, 21, 43, 16, 31, 26, 61, 20, 41, 28, 71, 22, 47, 34, 89, 27, 67, 52, 163, 24, 53, 42, 113, 32, 79, 60, 193, 25, 59, 45, 131, 38, 103, 84, 293, 30, 73, 57, 181, 40, 109, 95, 359, 33, 83, 65, 223, 49, 149, 119, 463, 39, 107, 91, 337, 72, 241, 209, 971, 35, 97, 74, 251, 58
Offset: 1

Views

Author

Antti Karttunen, May 09 2015

Keywords

Comments

Here oddprime(n) = n-th odd prime = A065091(n) = A000040(n+1), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).
This sequence can be represented as a binary tree. Each left hand child is produced as A065090(1+n), and each right hand child as A065091(n), when a parent contains n >= 1:
|
...................1...................
2 3
4......../ \........5 6......../ \........7
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
8 11 9 13 10 17 12 19
14 23 18 37 15 29 21 43 16 31 26 61 20 41 28 71
etc.
Because all odd primes are odd, it means that even terms can only occur in even positions (together with odd composites, A071904, for each one of which there is a separate infinite cycle), while terms in odd positions are all odd.

Crossrefs

Inverse: A257727.
Related or similar permutations: A246377, A246378, A257726, A257729, A257802.
Differs from A255004 for the first time at n=17, where a(17) = 23, while A255004(17) = 15.

Programs

Formula

a(1) = 1; a(2n) = A065090(1+a(n)), a(2n+1) = A065091(a(n)).
As a composition of other permutations:
a(n) = A257729(A246378(n)).
a(n) = A257802(A257726(n)).

A255003 Lexicographically earliest permutation of positive integers such that a(a(n)+a(n+1)) is even for all n.

Original entry on oeis.org

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

Views

Author

Eric Angelini and M. F. Hasler, Feb 11 2015

Keywords

Comments

From Eric Angelini, Feb 11 2015: (Start)
Let S denote this sequence. Then:
a) take two adjacent integers x and y in S
b) let (x + y) = z
c) a(z) is even.
S is extended with the smallest integer not yet in S and not leading to a contradiction.
Additional remarks:
The sequence T where a(a(n)+a(n+1)) is always odd is simply A000027.
But if we force a(1)=2 we then get again a permutation of A000027:
U = 2, 1, 3, 5, 4, 6, 7, 9, 11, 13, 8, 10, 15, 12, ,14, 17, 16, 19, 18, 21, 23, 20, 22, 25, 27, 29, 31, 24, 26, 28, 33, ... (A256210).
The sequence V where a(a(n)+a(n+1)) is always prime is also a permutation of A000027:
V = 1, 2, 3, 4, 5, 6, 7, 8, 11, 9, 13, 10, 17, 12, 19, 14, 15, 23, 29, 31, 16, 37, 41, 18, ... (A255004).
(End)
At least for the first 73 elements, successive blocks of numbers of size 2^m for various m>=0 each form permutations of some set of consecutive positive integers. We see blocks [1], [2], [4, 3], ..., [8, 10, 7, 9], ..., [62, 61, 64, 66, 63, 65, 68, 67]. If b(0) is the first element in such a block and b(2^m-1) the last, then for 0 <= i <= 2^m-1, b(i) + b(2^m-i-1) is constant. For example, in the latter block, 62 + 67 = 61 + 68 = 64 + 65 = 66 + 63, etc. - David A. Corneth, Mar 22 2015

Examples

			Checking the definition:
n = 1  2  3  4  5  6  7   8  9  10 11  12  13  14  15  16  17  18  19  20  21  22 ...
S = 1, 2, 4, 3, 5, 6, 8, 10, 7, 9, 12, 11, 13, 14, 15, 16, 18, 20, 17, 19, 22, 21,...
for n=1 then a(1)=1 and a(2)=2 and a(sum) reads a(1+2) reads a(3) which is 4 (even);
for n=2 then a(2)=2 and a(3)=4 and a(sum) reads a(2+4) reads a(6) which is 6 (even);
for n=3 then a(3)=4 and a(4)=3 and a(sum) reads a(4+3) reads a(7) which is 8 (even);
for n=4 then a(4)=3 and a(5)=5 and a(sum) reads a(3+5) reads a(8) which is 10 (even);
... etc.
		

Crossrefs

Programs

  • Maple
    N:= 100: # to get a(n) for n <= N
    maxodd:= 1:
    maxeven:= 0:
    a[1]:= 1:
    needeven:= {}:
    for n from 2 to N do
      if member(n,needeven) or maxeven < maxodd then
         a[n]:= maxeven + 2;
         maxeven:= a[n];
      else
         a[n]:= maxodd + 2;
         maxodd:= a[n];
      fi;
      needeven:= needeven union {a[n-1]+a[n]};
    od:
    seq(a[n],n=1..N); # Robert Israel, Mar 26 2015
  • Mathematica
    M = 100;
    maxodd = 1;
    maxeven = 0;
    a[1] = 1;
    needeven = {};
    For[n = 2, n <= M, n++, If[ MemberQ[needeven, n] || maxeven < maxodd, a[n] = maxeven + 2; maxeven = a[n], a[n] = maxodd + 2; maxodd = a[n]]; needeven = needeven ~Union~ {a[n-1] + a[n]}];
    Array[a, M] (* Jean-François Alcover, Apr 30 2019, after Robert Israel *)
  • PARI
    {a=vector(100,i,1); u=[1]/* used numbers beyond u[1] */; for(n=2,#a, if( a[n] < 0, a[n]=u[1]-u[1]%2; while(setsearch(u,a[n]+=2),), a[n]=u[1]; while(setsearch(u,a[n]++),)); u=setunion(u,[a[n]]); while( #u>1 && u[2]==u[1]+1, u=u[2..#u]); a[n]+a[n-1]>#a || a[a[n]+a[n-1]]=-1)}
Showing 1-3 of 3 results.