login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 4
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, 22, 29, 28, 23, 30, 31, 32, 33, 34, 49, 36, 41, 50, 51, 40, 37, 42, 53, 52, 43, 54, 59, 48, 35, 38, 57, 44, 45, 58, 55, 56, 39, 46, 61, 60, 47, 62, 63, 64, 65, 66, 97 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Leading zeros are ignored.
This sequence is a permutation of the nonnegative integers (as it is injective and preserves the binary length); see A333693 for the inverse.
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.
LINKS
FORMULA
a(2*n) = 2*a(n).
a(2*n+1) = A030101(2*a(n)+1).
A000120(a(n)) = A000120(n).
EXAMPLE
For n = 90:
- the binary representation of 90 is "1011010",
- this binary representation evolves as follows (parentheses indicate reversals):
(1)0 1 1 0 1 0
(1 0 1)1 0 1 0
(1 1 0 1)0 1 0
(1 0 1 0 1 1)0
- the resulting binary representation is "1010110"
- and a(90) = 86.
PROG
(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) }
CROSSREFS
See A333776 for a similar sequence.
Cf. A000120, A030101, A333693 (inverse), A333762 (fixed points).
Sequence in context: A033621 A332808 A108548 * A333693 A322464 A057889
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 04 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)