OFFSET
0,3
COMMENTS
LINKS
FORMULA
a(n) = n XOR floor(n/4), where XOR is binary exclusive OR. - Paul D. Hanna, Oct 25 2004
MATHEMATICA
Array[BitXor[#, Floor[#/4]] &, 72, 0] (* Michael De Vlieger, Apr 14 2018 *)
PROG
(MATLAB) A = 1; for i = 1:7 B = A(end:-1:1); A = [A (B + length(A))]; end A(A) - 1
(PARI) a(n)=bitxor(n, n\4)
(PARI) { for (n=0, 1000, write("b064706.txt", n, " ", bitxor(n, n\4)) ) } \\ Harry J. Smith, Sep 22 2009
(R)
maxn <- 63 # by choice
b <- c(1, 0, 0)
for(n in 4:maxn) b[n] <- b[n-1] - b[n-2] + b[n-3]
# c(1, b) is A133872
a <- 1
for(n in 1:maxn) {
a[2*n ] <- 2*a[n] + 1 - b[n]
a[2*n+1] <- 2*a[n] + b[n]
}
(a <- c(0, a))
# Yosu Yurramendi, Oct 25 2020
(Python)
def A064706(n): return n^ n>>2 # Chai Wah Wu, Jun 29 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Oct 13 2001
EXTENSIONS
More terms from David Wasserman, Aug 02 2002
STATUS
approved