[go: up one dir, main page]

login
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.
4
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,3
COMMENTS
a(n) represents the n-th finite subset of positive integers in Gray order, two consecutive sets differ in exactly one member: {}, {1}, {1,2}, {2}, {2,3}, {1,2,3}, {1,3}, {3}, {3,4}, {1,3,4}, {1,2,3,4}, {2,3,4}, ... .
a(n) is the concatenation of all terms in the n-th row of A227738 (for n>=1).
LINKS
Wikipedia, Gray code
FORMULA
a(2^n-1) = a(A000225(n)) = n.
a(floor(2^(n+1)/3)) = a(A000975(n)) = A007908(n).
EXAMPLE
A003188(17) = 25 = 11001_2 gives a(17) = 145.
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);
CROSSREFS
KEYWORD
nonn,look,base
AUTHOR
Alois P. Heinz, Feb 01 2023
STATUS
approved