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

A231551 Position of n in A231550.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Nov 10 2013

Keywords

Comments

This permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A020651/A020650, and A162911/A162912 (Drib) the enumeration system into A245327/A245326. - Yosu Yurramendi, Jun 16 2015

Crossrefs

Programs

  • Mathematica
    Join[{0, 1}, Table[d = Reverse@IntegerDigits[n, 2]; FromDigits[Reverse@Append[FoldList[BitXor, d[[1]], Most@Rest@d], d[[-1]]], 2], {n, 2, 67}]] (* Ivan Neretin, Dec 28 2016 *)
  • Python
    for n in range(99):
      bits = [0]*64
      orig = [0]*64
      l = int.bit_length(int(n))
      t = n
      for i in range(l):
        bits[i] = orig[i] = t&1
        t>>=1
      #for i in range(1, l-1):  bits[i] ^= orig[i-1]   # A231550
      for i in range(1, l-1):  bits[i] ^= bits[i-1]   # A231551
      #for i in range(l-1):  bits[i] ^= orig[i+1]      # A003188
      #for i in range(1, l):  bits[l-1-i] ^= bits[l-i]  # A006068
      t = 0
      for i in range(l):  t += bits[i]<
    				
  • R
    maxrow <- 8 # by choice
    b01 <- 0 # b01 is going to be A010059
    a <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
       b01[2^(m+1)+    k] <-     b01[2^m+k]
         a[2^(m+1)+    k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+    k])
       b01[2^(m+1)+2^m+k] <- 1 - b01[2^m+k]
         a[2^(m+1)+2^m+k] <-       a[2^m+k]  + 2^(m+b01[2^(m+1)+2^m+k])
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 10 2017
    
  • R
    maxblock <- 8 # by choice
    a <- 1:3
    for(n in 4:2^maxblock){
    ones <- which(as.integer(intToBits(n)) == 1)
    nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
    anbit <- nbit
    for(i in 2:(length(anbit) - 1))
       anbit[i] <- bitwXor(anbit[i], anbit[i-1])  # ?bitwXor
    a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 25 2021

Formula

A231550(a(n)) = a(A231550(n)) = n.
a(n) = A258996(A284460(n)) = A284459(A092569(n)), n > 0. - Yosu Yurramendi, Apr 10 2017
a(n) = A054429(A153154(n)), n > 0. - Yosu Yurramendi, Oct 04 2021

A154437 Permutation of nonnegative integers: A059893-conjugate of A154435.

Original entry on oeis.org

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

Author

Antti Karttunen, Jan 17 2009

Keywords

Comments

This permutation is induced by the same Lamplighter group generating wreath recursion (binary transducer) as A154435, starting from the active (swapping) state a, but in contrast to it, this one rewrites the bits from the least significant end up to the second most significant bit.

Crossrefs

Inverse: A154438. a(n) = A059893(A154435(A059893(n))) = A054429(A153154(A054429(n))).

Programs

  • R
    maxn <- 63 # by choice
    a <- c(1,3,2)
    for(n in 2:maxn){
    a[2*n+1] <- 2*a[n]
    if(n%%2 == 0) a[2*n] <- 2*a[n+1] + 1
    else          a[2*n] <- 2*a[n-1] + 1
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Feb 23 2020

Formula

From Yosu Yurramendi, Feb 23 2020: (Start)
a(n) = A054429(A284459(n)) = A258996(A153154(n)) = A284459(A065190(n)).
a(1) = 1; for n > 0, a(2*n) = 2*a(A065190(n)) + 1, a(2*n+1) = 2*a(n). (End)

A332769 Permutation of the positive integers: a(n) = A258996(A054429(n)) = A054429(A258996(n)).

Original entry on oeis.org

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

Author

Yosu Yurramendi, Feb 23 2020

Keywords

Comments

Sequence is self-inverse: a(a(n)) = n.
A002487(1+a(n)) = A162911(n) and A002487(a(n)) = A162912(n). So, a(n) generates the enumeration system of positive rationals based on Stern's sequence A002487 called 'drib'.
Given n, one can compute a(n) by taking into account the binary representation of n, and by flipping every second bit starting from the lowest until reaching the highest 1, which is not flipped.

Examples

			n = 23 =  10111_2
            x x
          10010_2 = 18 = a(n).
n = 33 = 100001_2
          x x x
         110100_2 = 52 = a(n).
		

Crossrefs

Similar R-programs: A258996, A284447.

Programs

  • PARI
    a(n) = bitxor(n, 2<Kevin Ryde, Mar 30 2021
  • R
    maxrow <- 6 # by choice
    a <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
    a[2^(m+1)+2*k  ] <- 2*a[2^(m+1)-1-k] + 1
    a[2^(m+1)+2*k+1] <- 2*a[2^(m+1)-1-k]
    }
    a
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- c(1, 3, 2)
    for(n in 4:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      anbit[seq(1, length(anbit) - 1, 2)] <- 1 - anbit[seq(1, length(anbit) - 1, 2)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Mar 30 2021
    

Formula

a(A054429(n)) = A054429(a(n)) = A258996(n),
a(A258996(n)) = A258996(a(n)) = A054429(n).
a(n) = A284447(A065190(n)) = A065190(A284447(n)),
a(A065190(n)) = A065190(a(n)) = A284447(n),
a(A284447(n)) = A284447(a(n)) = A065190(n).
a(A231551(n)) = A154437(n), a(A154437(n)) = A231551(n).
a(A153154(n)) = A284459(n), a(A284459(n)) = A153154(n).
a(1) = 1, a(2) = 3, a(3) = 2; for n > 3, a(2*n) = 2*a(A054429(n)) + 1, a(2*n+1) = 2*a(A054429(n)).
a(1) = 1; for m >= 0 and 0 <= k < 2^m, a(2^(m+1)+2*k) = 2*a(2^(m+1)-1-k) + 1, a(2^(m+1)+2*k+1) = 2*a(2^(m+1)-1-k).

A153153 Permutation of natural numbers: A059893-conjugate of A003188.

Original entry on oeis.org

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

Author

Antti Karttunen, Dec 20 2008

Keywords

Crossrefs

Inverse: A153154. a(n) = A059893(A003188(A059893(n))).

Programs

  • R
    a <- 1
    maxlevel <- 5 # by choice
    #
    for(m in 0:maxlevel) for(k in 0:(2^m-1)){
      a[2^(m+1)+2*k  ] <- 2*a[2^(m+1)-1-k] + 1
      a[2^(m+1)+2*k+1] <- 2*a[2^m+k]
    }
    a <- c(0,a)
    # Yosu Yurramendi, Jan 25 2020

Formula

a(n) = A065190(A231550(n)). - Yosu Yurramendi, Jan 15 2020
a(1) = 1, a(2^(m+1)+2*k) = 2*a(2^(m+1)-1-k), a(2^(m+1)+2*k+1) = 2*a(2^m+k), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Jan 25 2020
Showing 1-4 of 4 results.