A284459 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A245327/A245328, and A162911/A162912 (Drib) into A020651/A020650 (Yu-Ting inverted).
1, 2, 3, 6, 5, 4, 7, 10, 13, 12, 11, 14, 9, 8, 15, 26, 21, 20, 27, 22, 25, 24, 23, 18, 29, 28, 19, 30, 17, 16, 31, 42, 53, 52, 43, 54, 41, 40, 55, 50, 45, 44, 51, 46, 49, 48, 47, 58, 37, 36, 59, 38, 57, 56, 39, 34, 61, 60, 35, 62, 33, 32, 63
Offset: 1
Keywords
Links
Programs
-
R
maxrow <- 12 # by choice a <- 1 b01 <- 1 for(m in 0:maxrow){ b01 <- c(b01, c(1-b01[2^m:(2^(m+1)-1)], b01[2^m:(2^(m+1)-1)]) ) for(k in 0:(2^m-1)){ a[2^(m+1) + k] <- a[2^m + k] + 2^(m + b01[2^(m+1) + k]) a[2^(m+1) + 2^m + k] <- a[2^m + k] + 2^(m + b01[2^(m+1) + 2^m + k]) }} a # Yosu Yurramendi, Mar 27 2017
-
R
maxblock <- 7 # 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] <- 1 - bitwXor(anbit[i], anbit[i-1]) a <- c(a, sum(anbit*2^(0:(length(anbit) - 1)))) } a # Yosu Yurramendi, Apr 25 2021
Comments