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.

A233279 Permutation of nonnegative integers: a(n) = A054429(A006068(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 18 2013

Keywords

Comments

This permutation transforms the enumeration system of positive irreducible fractions A007305/A047679 (Stern-Brocot) into the enumeration system A071766/A229742 (HCS), and the enumeration system A162909/A162910 (Bird) into A245325/A245326. - Yosu Yurramendi, Jun 09 2015

Crossrefs

Inverse permutation: A233280.

Programs

  • Mathematica
    Module[{nn = 6, s}, s = Flatten[Table[Range[2^(n + 1) - 1, 2^n, -1], {n, 0, nn}]]; Map[If[# == 0, 0, s[[#]]] &, Table[Fold[BitXor, n, Quotient[n, 2^Range[BitLength[n] - 1]]], {n, 0, 2^nn}]]] (* Michael De Vlieger, Apr 06 2017, after Harvey P. Dale at A054429 and Jan Mangaldan at A006068 *)
  • Python
    from sympy import floor
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a054429(n): return 1 if n==1 else 2*a054429(floor(n/2)) + 1 - n%2
    def a(n): return 0 if n==0 else a054429(a006068(n)) # Indranil Ghosh, Jun 11 2017
  • R
    maxrow <- 8 # by choice
    a <- 1:3
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
    a[2^(m+2)+            k] <- a[2^(m+1)+    k] + 2^(m+1)
    a[2^(m+2)+        2^m+k] <- a[2^(m+1)+2^m+k] + 2^(m+1)
    a[2^(m+2)+2^(m+1)+    k] <- a[2^(m+1)+2^m+k] + 2^(m+2)
    a[2^(m+2)+2^(m+1)+2^m+k] <- a[2^(m+1)+   +k] + 2^(m+2)
    }
    (a <- c(0,a))
    # Yosu Yurramendi, Apr 05 2017
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- 1
    for(n in 2:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      for(k in 2^(0:floor(log2(length(nbit))))  )
        anbit <- bitwXor(anbit, c(anbit[-(1:k)], rep(0,k))) # ?bitwXor
      anbit[0:(length(anbit) - 1)] <- 1 - anbit[0:(length(anbit)-1)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    (a <- c(0,a))
    # Yosu Yurramendi, May 29 2021
    
  • Scheme
    (define (A233279 n) (A054429 (A006068 n)))
    

Formula

a(n) = A054429(A006068(n)).
a(n) = A006068(A063946(n)).
a(n) = A154435(A054429(n)).
a(n) = A180200(A258746(n)) = A117120(A180200(n)), n > 0. - Yosu Yurramendi, Apr 10 2017