%I #42 Sep 22 2024 17:47:35
%S 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,
%T 22,25,20,27,26,21,32,63,62,33,60,35,34,61,56,39,38,57,36,59,58,37,48,
%U 47,46,49,44,51,50,45,40,55,54,41,52,43,42,53,64,127,126,65
%N Position of n in A231550.
%C 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
%H Ivan Neretin, <a href="/A231551/b231551.txt">Table of n, a(n) for n = 0..8192</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the nonnegative integers</a>
%F A231550(a(n)) = a(A231550(n)) = n.
%F a(n) = A258996(A284460(n)) = A284459(A092569(n)), n > 0. - _Yosu Yurramendi_, Apr 10 2017
%F a(n) = A054429(A153154(n)), n > 0. - _Yosu Yurramendi_, Oct 04 2021
%t 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 *)
%o (Python)
%o for n in range(99):
%o bits = [0]*64
%o orig = [0]*64
%o l = int.bit_length(int(n))
%o t = n
%o for i in range(l):
%o bits[i] = orig[i] = t&1
%o t>>=1
%o #for i in range(1, l-1): bits[i] ^= orig[i-1] # A231550
%o for i in range(1, l-1): bits[i] ^= bits[i-1] # A231551
%o #for i in range(l-1): bits[i] ^= orig[i+1] # A003188
%o #for i in range(1, l): bits[l-1-i] ^= bits[l-i] # A006068
%o t = 0
%o for i in range(l): t += bits[i]<<i
%o print(str(t), end=', ')
%o (R)
%o maxrow <- 8 # by choice
%o b01 <- 0 # b01 is going to be A010059
%o a <- 1
%o for(m in 0:maxrow) for(k in 0:(2^m-1)){
%o b01[2^(m+1)+ k] <- b01[2^m+k]
%o a[2^(m+1)+ k] <- a[2^m+k] + 2^(m+b01[2^(m+1)+ k])
%o b01[2^(m+1)+2^m+k] <- 1 - b01[2^m+k]
%o a[2^(m+1)+2^m+k] <- a[2^m+k] + 2^(m+b01[2^(m+1)+2^m+k])
%o }
%o (a <- c(0,a))
%o # _Yosu Yurramendi_, Apr 10 2017
%o (R)
%o maxblock <- 8 # by choice
%o a <- 1:3
%o for(n in 4: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(i in 2:(length(anbit) - 1))
%o anbit[i] <- bitwXor(anbit[i], anbit[i-1]) # ?bitwXor
%o a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
%o }
%o (a <- c(0,a))
%o # _Yosu Yurramendi_, Apr 25 2021
%Y Cf. A003188, A006068, A231550.
%K nonn,easy,look
%O 0,3
%A _Alex Ratushnyak_, Nov 10 2013