(define (complement-i-evenpos-lsbs n i) (if (zero? i) n (+ (- 1 (modulo n 2)) (* 2 (complement-i-oddpos-lsbs (floor->exact (/ n 2)) (-1+ i))))))

(define (complement-i-oddpos-lsbs n i) (+ (* 2 (complement-i-evenpos-lsbs (floor->exact (/ n 2)) i)) (modulo n 2)))

CROSSREFS

Inverse: A163486. This permutation can be used to construct array A147995 and its transpose A163545. See A163355 for a bit similarly defined recursive permutation.