OFFSET
1,2
COMMENTS
The inverse permutation is A284460.
LINKS
FORMULA
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Yosu Yurramendi, Mar 27 2017
STATUS
approved