OFFSET
1,5
COMMENTS
Row sums are: 1, 2, 8, 30, 147, 958, 1082, 1388, 2651, 6430,...
LINKS
Eric W. Weisstein, Gray Code
FORMULA
EXAMPLE
1;
1, 1;
1, 6, 1;
1, 14, 14, 1;
1, 23, 99, 23, 1;
1, 37, 441, 441, 37, 1;
1, 68, 244, 456, 244, 68, 1;
1, 140, 167, 386, 386, 167, 140, 1;
1, 269, 408, 255, 785, 255, 408, 269, 1;
1, 527, 912, 788, 987, 987, 788, 912, 527, 1;
MATHEMATICA
Code 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_] := f[x, n] = (1 - x)^(n + 1)*Sum[k^n*x^k, {k, 0, Infinity}]/x; Table[FullSimplify[ExpandAll[f[x, n]]], {n, 0, 10}]; a = Table[CoefficientList[FullSimplify[ExpandAll[f[x, n]]], x], {n, 1, 10}]; Table[Flatten[Table[GrayCode[a[[n]][[m]], 10], {m, 1, n}]], {n, 1, Length[ a]}]; Flatten[%]
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula and Gary W. Adamson, Oct 20 2008
EXTENSIONS
Edited by R. J. Mathar, Mar 10 2015
STATUS
approved