A333776 Scan the binary representation of n from right to left; at each 1, reverse the bits to the right and excluding this 1. The resulting binary representation is that of a(n).
0, 1, 2, 3, 4, 6, 5, 7, 8, 12, 10, 14, 9, 11, 13, 15, 16, 24, 20, 28, 18, 22, 26, 30, 17, 19, 21, 23, 25, 29, 27, 31, 32, 48, 40, 56, 36, 44, 52, 60, 34, 38, 42, 46, 50, 58, 54, 62, 33, 35, 37, 39, 41, 45, 43, 47, 49, 57, 53, 61, 51, 55, 59, 63, 64, 96, 80
Offset: 0
Examples
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 0 1(0 1 0 1) 1(1 0 1 0 1 0) - the resulting binary representation is "1101010" - and a(90) = 106. The binary plot of the first terms is as follows (#'s denote 1's): ################################ ################ # # ## #### ######## ######## # # ## #### ## # # ## # # #### # # ## #### # # ## ## # # ## # # #### # # ## ## # # ## # # ## # # ## # # #### # # ## ######## # # ## #### # # ## #### ######## ################ 1 2 3 4 5 6 0123456789012345678901234567890123456789012345678901234567890123
Links
Crossrefs
Programs
-
PARI
a(n, base=2) = { my (d=digits(n, base), t=[]); forstep (k=#d, 1, -1, if (d[k], t=Vecrev(t)); t=concat(d[k], t)); fromdigits(t, base); }
Comments