OFFSET
0,4
COMMENTS
EXAMPLE
3 = 2^0 + 2^1 = 2^(2*0) + 2^((2*0)+1) encodes the CGT tree \/ which has two terminal nodes, thus a(3)=2.
64 = 2^6 = 2^(2*3), i.e. it encodes the CGT tree
\/
.\
which also has two terminal (non-root) nodes, so a(64)=2.
PROG
(Scheme:) (define (A106487 n) (cond ((zero? n) 1) (else (apply + (map A106487 (map shr (on-bit-indices n))))))) (define (shr n) (if (odd? n) (/ (- n 1) 2) (/ n 2))) (define (on-bit-indices n) (let loop ((n n) (i 0) (c (list))) (cond ((zero? n) (reverse! c)) ((odd? n) (loop (/ (- n 1) 2) (1+ i) (cons i c))) (else (loop (/ n 2) (1+ i) c)))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 21 2005
STATUS
approved