login
A163485
Permutation of integers used for constructing A147995 and A163545.
5
0, 3, 1, 2, 14, 15, 13, 12, 6, 7, 5, 4, 8, 11, 9, 10, 58, 57, 59, 56, 62, 63, 61, 60, 54, 55, 53, 52, 50, 49, 51, 48, 26, 25, 27, 24, 30, 31, 29, 28, 22, 23, 21, 20, 18, 17, 19, 16, 32, 35, 33, 34, 46, 47, 45, 44, 38, 39, 37, 36, 40, 43, 41, 42, 234, 233, 235, 232, 228, 229
OFFSET
0,2
PROG
(MIT Scheme:)
(define (A163485 n) (let* ((i (floor->exact (/ (A000523 n) 2))) (dd (modulo (floor->exact (/ n (expt 4 i))) 4)) (r (if (zero? n) n (modulo n (expt 4 i))))) (cond ((zero? n) n) ((= 0 dd) (A163485 r)) ((= 1 dd) (+ (* 3 (expt 4 i)) (- (expt 4 i) 1 (A163485 (complement-i-oddpos-lsbs (A057300 r) i))))) ((= 2 dd) (+ (expt 4 i) (- (expt 4 i) 1 (A163485 (complement-i-oddpos-lsbs (A057300 r) i))))) (else (+ (* 2 (expt 4 i)) (A163485 r))))))
(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.
Sequence in context: A198627 A198654 A198661 * A276011 A126038 A088363
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 01 2009
STATUS
approved