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

A145341 Convert 2n-1 to binary. Reverse its digits. Convert back to decimal to get a(n).

Original entry on oeis.org

1, 3, 5, 7, 9, 13, 11, 15, 17, 25, 21, 29, 19, 27, 23, 31, 33, 49, 41, 57, 37, 53, 45, 61, 35, 51, 43, 59, 39, 55, 47, 63, 65, 97, 81, 113, 73, 105, 89, 121, 69, 101, 85, 117, 77, 109, 93, 125, 67, 99, 83, 115, 75, 107, 91, 123, 71, 103, 87, 119, 79, 111, 95, 127, 129, 193
Offset: 1

Views

Author

Leroy Quet, Oct 08 2008

Keywords

Comments

This sequence is a permutation of the odd positive integers.
From Yosu Yurramendi, Feb 05 2019: (Start)
If the terms (n > 0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
3, 5,
7, 9, 13, 11,
15, 17, 25, 21, 29, 19, 27, 23,
31, 33, 49, 41, 57, 37, 53, 45, 61, 35, 51, 43, 59, 39, 55, 47,
63, 65, 97, 81, 113, 73, 105, 89, 121, 69, 101, 85, 117, 77, 109, 93, 125, ...
for m > 0, a(2^(m+1)) = 2*a(2^m) + 1; a(2^m + 1) = a(2^m) + 2; a(2^(m+1) + 2^m) = 2*a(2^(m+1)) - 1,
for m > 0, 0 < k < 2^m, a(2^(m+1) + k) = 2*a(2^m + k) - 1, a(2^(m+1) + 2^m + k) = a(2^(m+1) + k) + 2.
This relationship is enough to reproduce the sequence.
If the terms (n > 0) are written as an array (right-aligned fashion):
1,
3, 5,
7, 9, 13, 11,
15, 17, 25, 21, 29, 19, 27, 23,
31, 33, 49, 41, 57, 37, 53, 45, 61, 35, 51, 43, 59, 39, 55, 47,
... 93, 125, 67, 99, 83, 115, 75, 107, 91, 123, 71, 103, 87, 119, 79, 111, 95,
...
for m >= 0, a(2^(m+1)+2^m) = 4*a(2^m) + 1.
for m >= 0, 0 <= k < 2^m-1, a(2^(m+2)-1-k) = 2*a(2^(m+1)-1-k) + 1.
(End)

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[2*n - 1, 2]], 2], {n, 1, 100}] (* Stefan Steinerberger, Oct 11 2008 *)
  • PARI
    a(n) = fromdigits(Vecrev(binary(2*n-1)), 2); \\ Michel Marcus, Feb 04 2019
  • R
    nmax <- 10^3 # by choice
      a <- vector()
      for (o in seq(1,nmax,2)){
        w <- which(as.numeric(intToBits(o))==1)
        a <- c(a, sum(2^(max(w)-w)))
    }
    a[1:66]
    # Yosu Yurramendi, Feb 04 2019
    

Formula

a(n) = A030101(2n-1).
a(n) = A145342(n)*2 - 1.

Extensions

More terms from R. J. Mathar, Ray Chandler and Stefan Steinerberger, Oct 10 2008

A153036 Integer parts of the full Stern-Brocot tree.

Original entry on oeis.org

0, 1, 0, 2, 0, 0, 1, 3, 0, 0, 0, 0, 1, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 22 2008

Keywords

Examples

			a(1): 1;
a(2..3): 1x0, 2;
a(4..7): 2x0, 1x1, 3;
a(8..15): 4x0, 2x1, 1x2, 4;
a(16..31): 8x0, 4x1, 2x2, 1x3, 5;
a(32..63): 16x0, 8x1, 4x2, 2x3, 1x4, 6;
a(64..127): 32x0, 16x1, 8x2, 4x3, 2x4, 1x5, 7;
a(128..255): 64x0, 32x1, 16x2, 8x3, 4x4, 2x5, 1x6, 8;
a(256..511): 128x0, 64x1, 32x2, 16x3, 8x4, 4x5, 2x6, 1x7, 9.
		

Crossrefs

Cf. A130321.
If every block of terms of length 2^k is reversed, we get A290256; other permutations within these blocks give A007814 and A272729-1.

Formula

a(n+1) = floor(A007305(n+2)/A047679(n)). [Corrected by Andrey Zabolotskiy, Jul 23 2020]
a(n) = if n=2^k-1 then k else Log2(n)-1-Log2(2^(Log2(n)+1)-(n+1)), where Log2=A000523.
From Andrey Zabolotskiy, Oct 07 2021: (Start)
Formulas discovered by Sequence Machine (and also essentially by Kevin Ryde):
a(n) = A090996(n) - A043545(n).
a(n) = A007814(A145342(n+1)). (End)

Extensions

a(0) = 0 added by Andrey Zabolotskiy, Jul 23 2020
Showing 1-2 of 2 results.