A360287 a(n) is the concatenation of the positions of 1-bits in the binary expansion of the Gray code for n, when 1 is the rightmost position; a(0) = 0.
0, 1, 12, 2, 23, 123, 13, 3, 34, 134, 1234, 234, 24, 124, 14, 4, 45, 145, 1245, 245, 2345, 12345, 1345, 345, 35, 135, 1235, 235, 25, 125, 15, 5, 56, 156, 1256, 256, 2356, 12356, 1356, 356, 3456, 13456, 123456, 23456, 2456, 12456, 1456, 456, 46, 146, 1246, 246
Offset: 0
Examples
A003188(17) = 25 = 11001_2 gives a(17) = 145.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..16383
- Wikipedia, Gray code
Programs
-
Maple
a:= n-> `if`(n=0, 0, (l-> parse(cat(seq(`if`(l[i]=1, i, [][]), i=1..nops(l)))))(Bits[Split](Bits[Xor](n, iquo(n, 2))))): seq(a(n), n=0..100);
Comments