login
A126007
Involution of nonnegative integers: Keep the least significant quaternary digit q0 of n fixed, but swap the positions of digits q1 <-> q2, q3 <-> q4, ..., etc. in the base-4 expansion of n (where n = ... + q4*256 + q3*64 + q2*16 + q1*4 + q0).
4
0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51, 4, 5, 6, 7, 20, 21, 22, 23, 36, 37, 38, 39, 52, 53, 54, 55, 8, 9, 10, 11, 24, 25, 26, 27, 40, 41, 42, 43, 56, 57, 58, 59, 12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63, 256, 257, 258, 259, 272
OFFSET
0,3
FORMULA
a(n) = (n mod 4) + 4*A126006(floor(n/4)).
a(n) = A057300(A126008(n)) = A126008(A057300(n)).
PROG
(MIT Scheme:)
(define (A126007 n) (+ (modulo n 4) (* 4 (A126006 (floor->exact (/ n 4))))))
(C) uint32_t a(uint32_t n) { return ((n & 0xcccccccc) << 2) | ((n & 0x33333330) >> 2) | (n & 3); } /* Falk Hüffner, Jan 23 2022 */
(PARI) f(n) = my(d=Vecrev(digits(n, 4))); if (#d % 2, d = concat(d, 0)); fromdigits(Vecrev(vector(#d, i, d[i+(-1)^(i-1)])), 4); \\ A126006
a(n) = (n % 4) + 4*f(n\4); \\ Michel Marcus, Jan 23 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Jan 02 2007
STATUS
approved