cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

This page as a plain text file.
%I A126007 #18 Jul 01 2025 21:40:14
%S A126007 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,
%T A126007 37,38,39,52,53,54,55,8,9,10,11,24,25,26,27,40,41,42,43,56,57,58,59,
%U A126007 12,13,14,15,28,29,30,31,44,45,46,47,60,61,62,63,256,257,258,259,272
%N 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).
%H A126007 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A126007 a(n) = (n mod 4) + 4*A126006(floor(n/4)).
%F A126007 a(n) = A057300(A126008(n)) = A126008(A057300(n)).
%o A126007 (MIT/GNU Scheme)
%o A126007 (define (A126007 n) (+ (modulo n 4) (* 4 (A126006 (floor->exact (/ n 4))))))
%o A126007 (C)
%o A126007 #include <stdint.h>
%o A126007 uint32_t a(uint32_t n) { return ((n & 0xcccccccc) << 2) | ((n & 0x33333330) >> 2) | (n & 3); } /* _Falk Hüffner_, Jan 23 2022 */
%o A126007 (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
%o A126007 a(n) = (n % 4) + 4*f(n\4); \\ _Michel Marcus_, Jan 23 2022
%Y A126007 Cf. A057300, A126006, A126008.
%K A126007 nonn,base
%O A126007 0,3
%A A126007 _Antti Karttunen_, Jan 02 2007