%I #38 Jun 20 2021 21:52:35
%S 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,
%T 28,29,24,25,27,26,32,33,35,34,39,38,36,37,47,46,44,45,40,41,43,42,63,
%U 62,60,61,56,57,59,58,48,49,51,50,55,54,52,53,64,65,67,66
%N Permutation of nonnegative integers: a(n) = A054429(A006068(n)).
%C 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
%H Antti Karttunen, <a href="/A233279/b233279.txt">Table of n, a(n) for n = 0..8191</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(n) = A054429(A006068(n)).
%F a(n) = A006068(A063946(n)).
%F a(n) = A154435(A054429(n)).
%F a(n) = A180200(A258746(n)) = A117120(A180200(n)), n > 0. - _Yosu Yurramendi_, Apr 10 2017
%t 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 *)
%o (Scheme) (define (A233279 n) (A054429 (A006068 n)))
%o (R)
%o maxrow <- 8 # by choice
%o a <- 1:3
%o for(m in 0:maxrow) for(k in 0:(2^m-1)){
%o a[2^(m+2)+ k] <- a[2^(m+1)+ k] + 2^(m+1)
%o a[2^(m+2)+ 2^m+k] <- a[2^(m+1)+2^m+k] + 2^(m+1)
%o a[2^(m+2)+2^(m+1)+ k] <- a[2^(m+1)+2^m+k] + 2^(m+2)
%o a[2^(m+2)+2^(m+1)+2^m+k] <- a[2^(m+1)+ +k] + 2^(m+2)
%o }
%o (a <- c(0,a))
%o # _Yosu Yurramendi_, Apr 05 2017
%o (R)
%o # Given n, compute a(n) by taking into account the binary representation of n
%o maxblock <- 7 # by choice
%o a <- 1
%o for(n in 2:2^maxblock){
%o ones <- which(as.integer(intToBits(n)) == 1)
%o nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
%o anbit <- nbit
%o for(k in 2^(0:floor(log2(length(nbit)))) )
%o anbit <- bitwXor(anbit, c(anbit[-(1:k)], rep(0,k))) # ?bitwXor
%o anbit[0:(length(anbit) - 1)] <- 1 - anbit[0:(length(anbit)-1)]
%o a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
%o }
%o (a <- c(0,a))
%o # _Yosu Yurramendi_, May 29 2021
%o (Python)
%o from sympy import floor
%o def a006068(n):
%o s=1
%o while True:
%o ns=n>>s
%o if ns==0: break
%o n=n^ns
%o s<<=1
%o return n
%o def a054429(n): return 1 if n==1 else 2*a054429(floor(n/2)) + 1 - n%2
%o def a(n): return 0 if n==0 else a054429(a006068(n)) # _Indranil Ghosh_, Jun 11 2017
%Y Inverse permutation: A233280.
%Y Cf. A006068, A054429, A063946, A154435.
%K nonn
%O 0,3
%A _Antti Karttunen_, Dec 18 2013