login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of 1's in the Gray code for binomial(n,m).
2

%I #10 Aug 16 2020 07:55:27

%S 1,1,1,1,2,1,1,1,1,1,1,2,2,2,1,1,3,4,4,3,1,1,2,1,4,1,2,1,1,1,5,3,3,5,

%T 1,1,1,2,2,2,4,2,2,2,1,1,3,4,6,2,2,6,4,3,1,1,4,5,2,6,2,6,2,5,4,1

%N Number of 1's in the Gray code for binomial(n,m).

%C Row sums are: 1, 2, 4, 4, 8, 16, 12, 20, 18, 32, 38,....

%H Eric W. Weisstein’s World of Mathematics, <a href="https://mathworld.wolfram.com/GrayCode.html">Gray code</a>

%F T(n,m) = A005811(binomial(n,m)), 0<=m<=n.

%e 1;

%e 1, 1;

%e 1, 2, 1;

%e 1, 1, 1, 1;

%e 1, 2, 2, 2, 1;

%e 1, 3, 4, 4, 3, 1;

%e 1, 2, 1, 4, 1, 2, 1;

%e 1, 1, 5, 3, 3, 5, 1, 1;

%e 1, 2, 2, 2, 4, 2, 2, 2, 1;

%e 1, 3, 4, 6, 2, 2, 6, 4, 3, 1;

%e 1, 4, 5, 2, 6, 2, 6, 2, 5, 4, 1;

%p A178058 := proc(n,m)

%p A005811(binomial(n,m)) ;

%p end proc: # _R. J. Mathar_, Mar 10 2015

%t GrayCodeList[k_] := Module[{b = IntegerDigits[k, 2], i},

%t Do[

%t If[b[[i - 1]] == 1, b[[i]] = 1 - b[[i]]],

%t {i, Length[b], 2, -1}

%t ];

%t b

%t ]

%t Table[Table[Apply[Plus, GrayCodeList[Binomial[n, m]]], {m, 0, n}], {n, 0, 10}];

%t Flatten[%]

%Y Cf. A143214.

%K nonn,tabl

%O 0,5

%A _Roger L. Bagula_, May 18 2010

%E Edited by _R. J. Mathar_, Mar 10 2015