I.e. 23 is 10111 in binary, which after rewriting is 111, thus a(23) = 7, while 38 is 100110 in binary, which after the rewriting is 10010, i.e. a(38) = 18.

PROG

(MIT Scheme) (define (A072650 n) (let loop ((n n) (s 0) (i 0)) (cond ((zero? n) s) ((even? n) (loop (floor->exact (/ n 2)) s (1+ i))) (else (loop (floor->exact (/ n 4)) (+ s (expt 2 i)) (1+ i))))))