login
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

%I #31 Feb 02 2023 16:46:19

%S 0,1,12,2,23,123,13,3,34,134,1234,234,24,124,14,4,45,145,1245,245,

%T 2345,12345,1345,345,35,135,1235,235,25,125,15,5,56,156,1256,256,2356,

%U 12356,1356,356,3456,13456,123456,23456,2456,12456,1456,456,46,146,1246,246

%N 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.

%C 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}, ... .

%C a(n) is the concatenation of all terms in the n-th row of A227738 (for n>=1).

%H Alois P. Heinz, <a href="/A360287/b360287.txt">Table of n, a(n) for n = 0..16383</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Gray_code">Gray code</a>

%F a(2^n-1) = a(A000225(n)) = n.

%F a(floor(2^(n+1)/3)) = a(A000975(n)) = A007908(n).

%e A003188(17) = 25 = 11001_2 gives a(17) = 145.

%p a:= n-> `if`(n=0, 0, (l-> parse(cat(seq(`if`(l[i]=1, i, [][]),

%p i=1..nops(l)))))(Bits[Split](Bits[Xor](n, iquo(n, 2))))):

%p seq(a(n), n=0..100);

%Y Cf. A000225, A000975, A003188, A007908, A048794, A227738.

%K nonn,look,base

%O 0,3

%A _Alois P. Heinz_, Feb 01 2023