OFFSET
0,3
COMMENTS
LINKS
FORMULA
MATHEMATICA
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 *)
PROG
(Python)
for n in range(99):
bits = [0]*64
orig = [0]*64
l = int.bit_length(int(n))
t = n
for i in range(l):
bits[i] = orig[i] = t&1
t>>=1
#for i in range(1, l-1): bits[i] ^= orig[i-1] # A231550
for i in range(1, l-1): bits[i] ^= bits[i-1] # A231551
#for i in range(l-1): bits[i] ^= orig[i+1] # A003188
#for i in range(1, l): bits[l-1-i] ^= bits[l-i] # A006068
t = 0
for i in range(l): t += bits[i]<<i
print(str(t), end=', ')
(R)
maxrow <- 8 # by choice
b01 <- 0 # b01 is going to be A010059
a <- 1
for(m in 0:maxrow) for(k in 0:(2^m-1)){
b01[2^(m+1)+ k] <- b01[2^m+k]
a[2^(m+1)+ k] <- a[2^m+k] + 2^(m+b01[2^(m+1)+ k])
b01[2^(m+1)+2^m+k] <- 1 - b01[2^m+k]
a[2^(m+1)+2^m+k] <- a[2^m+k] + 2^(m+b01[2^(m+1)+2^m+k])
}
(a <- c(0, a))
# Yosu Yurramendi, Apr 10 2017
(R)
maxblock <- 8 # 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] <- bitwXor(anbit[i], anbit[i-1]) # ?bitwXor
a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
}
(a <- c(0, a))
# Yosu Yurramendi, Apr 25 2021
CROSSREFS
KEYWORD
AUTHOR
Alex Ratushnyak, Nov 10 2013
STATUS
approved