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).
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
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 1 0 1)0 1 0 (1 0 1 0 1 1)0 - the resulting binary representation is "1010110" - and a(90) = 86.
Links
Crossrefs
Programs
-
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) }
Comments