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.

A333692 Scan the binary representation of n from left to right; at each 1, reverse the bits to the left and including this 1. The resulting binary representation is that of a(n).

This page as a plain text file.
%I A333692 #16 Apr 07 2020 12:19:39
%S A333692 0,1,2,3,4,5,6,7,8,9,10,13,12,11,14,15,16,17,18,25,20,21,26,27,24,19,
%T A333692 22,29,28,23,30,31,32,33,34,49,36,41,50,51,40,37,42,53,52,43,54,59,48,
%U A333692 35,38,57,44,45,58,55,56,39,46,61,60,47,62,63,64,65,66,97
%N A333692 Scan the binary representation of n from left to right; at each 1, reverse the bits to the left and including this 1. The resulting binary representation is that of a(n).
%C A333692 Leading zeros are ignored.
%C A333692 This sequence is a permutation of the nonnegative integers (as it is injective and preserves the binary length); see A333693 for the inverse.
%C A333692 We can devise a variant of this sequence for any fixed base b > 1, by performing a reversal at each nonzero digit in base b.
%H A333692 Rémy Sigrist, <a href="/A333692/b333692.txt">Table of n, a(n) for n = 0..8192</a>
%H A333692 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H A333692 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A333692 a(2*n) = 2*a(n).
%F A333692 a(2*n+1) = A030101(2*a(n)+1).
%F A333692 A000120(a(n)) = A000120(n).
%e A333692 For n = 90:
%e A333692 - the binary representation of 90 is "1011010",
%e A333692 - this binary representation evolves as follows (parentheses indicate reversals):
%e A333692    (1)0 1 1 0 1 0
%e A333692    (1 0 1)1 0 1 0
%e A333692    (1 1 0 1)0 1 0
%e A333692    (1 0 1 0 1 1)0
%e A333692 - the resulting binary representation is "1010110"
%e A333692 - and a(90) = 86.
%o A333692 (PARI) a(n, base=2)={ my (b=digits(n, base), p=[]); for (k=1, #b, p=concat(p, b[k]); if (b[k], p=Vecrev(p))); fromdigits(p, base) }
%Y A333692 See A333776 for a similar sequence.
%Y A333692 Cf. A000120, A030101, A333693 (inverse), A333762 (fixed points).
%K A333692 nonn,base
%O A333692 0,3
%A A333692 _Rémy Sigrist_, Apr 04 2020