%I #12 Jul 08 2021 11:41:28
%S 1,1,1,1,5,1,1,28,28,1,1,106,149,106,1,1,155,987,987,155,1,1,955,440,
%T 514,440,955,1,1,194,137,974,974,137,194,1,1,340,754,60,293,60,754,
%U 340,1,1,181,238,166,377,377,166,238,181,1,1,977,283,540,411,142,411,540
%N Triangle T(n,m) read by rows: Gray code of A060187(n,m) (decimal representation), 1<=m<=n.
%C Row sums are 1, 2, 7, 58, 363, 2286, 3306, 2612, 2603, 1926, 4566,...
%H Eric Weisstein, <a href="http://mathworld.wolfram.com/notebooks/Combinatorics/GrayCode.nb">Mathematica Notebook GrayCode.nb</a>
%H Eric Weisstein, <a href="http://mathworld.wolfram.com/GrayCode.html">Gray Code</a>, MathWorld.
%F T(n,m) = A003188(A060187(n,m)). - _R. J. Mathar_, Nov 11 2011
%e 1;
%e 1, 1;
%e 1, 5, 1;
%e 1, 28, 28, 1;
%e 1, 106, 149, 106, 1;
%e 1, 155, 987, 987, 155, 1;
%e 1, 955, 440, 514, 440, 955, 1;
%e 1, 194, 137, 974, 974, 137, 194, 1;
%e 1, 340, 754, 60, 293, 60, 754, 340, 1;
%e 1, 181, 238, 166, 377, 377, 166, 238, 181, 1;
%e 1, 977, 283, 540, 411, 142, 411, 540, 283, 977, 1;
%t GrayCodeList[k_] := Module[{b = IntegerDigits[k, 2], i}, Do[ If[b[[i - 1]] == 1, b[[i]] = 1 - b[[i]]], {i, Length[b], 2, -1} ]; b ]; FromGrayCodeList[d_] := Module[{b = d, i, j}, Do[ If[Mod[Sum[b[[j]], {j, i - 1}], 2] == 1, b[[i]] = 1 - b[[i]]], {i, n = Length[d], 2, -1} ]; FromDigits[b, 2] ]; GrayCode[i_, n_] := FromDigits[BitXor @@@ Partition[Prepend[ IntegerDigits[i, 2, n], 0], 2, 1], 2] FromGrayCode[i_, n_] := FromDigits[BitXor[IntegerDigits[i, 2, n], FoldList[ BitXor, 0, Most[IntegerDigits[i, 2, n]]]], 2]; Clear[f, a, n, m, x]; (*A123125*) f[x_, n_] :=2^n*(1 - x)^(1 + n)*LerchPhi[x, -n, 1/2]; Table[FullSimplify[ExpandAll[f[x, n]]], {n, 0, 10}]; a = Table[CoefficientList[FullSimplify[ExpandAll[f[x, n]]], x], {n, 1, 10}]; b=Table[Flatten[Table[GrayCode[a[[n]][[m]], 10], {m, 1, n}]], {n, 1, Length[ a]}]; Flatten[%]
%Y Cf. A060187.
%K nonn,tabl
%O 1,5
%A _Roger L. Bagula_ and _Gary W. Adamson_, Oct 20 2008
|