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.

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