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.

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