login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A143214 Gray code applied to Pascal's triangle: T(n,m)=GrayCode(binomial(n,m)). 4

%I

%S 1,1,1,1,3,1,1,2,2,1,1,6,5,6,1,1,7,15,15,7,1,1,5,8,30,8,5,1,1,4,31,50,

%T 50,31,4,1,1,12,18,36,101,36,18,12,1,1,13,54,126,65,65,126,54,13,1,1,

%U 15,59,68,187,130,187,68,59,15,1

%N Gray code applied to Pascal's triangle: T(n,m)=GrayCode(binomial(n,m)).

%C Row sums are 1, 2, 5, 6, 19, 46, 58, 172, 235, 518, 790, ... .

%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(binomial(n,m)).

%e 1;

%e 1, 1;

%e 1, 3, 1;

%e 1, 2, 2, 1;

%e 1, 6, 5, 6, 1;

%e 1, 7, 15, 15, 7, 1;

%e 1, 5, 8, 30, 8, 5, 1;

%e 1, 4, 31, 50, 50, 31, 4, 1;

%e 1, 12, 18, 36, 101, 36, 18, 12, 1;

%e 1, 13, 54, 126, 65, 65, 126, 54, 13, 1;

%e 1, 15, 59, 68, 187, 130, 187, 68, 59, 15, 1;

%p A143214 := proc(n,m)

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

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

%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]; a = Table[Table[Binomial[n, m], {m, 0, n}], {n, 0, 10}] b=Table[Flatten[Table[GrayCode[a[[n]][[m]], 10], {m, 1, n}]], {n, 1, Length[ a]}]; Flatten[%]

%t (* program for a fractal picture modulo two: *)

%t c = Table[Table[If[m <= n, Mod[b[[n]][[m]], 2], 0], {m, 1, Length[b]}], {n, 1, Length[b]}]; ListDensityPlot[c, Mesh -> False]

%t (* The fractal pattern is the same for Pascal's triangle and the MacMahon numbers, A060187, but not for Eulerian numbers, A123125.*)

%Y Cf. A123125, A060187.

%K nonn,tabl

%O 1,5

%A _Roger L. Bagula_ and _Gary W. Adamson_, Oct 20 2008

%E Edited by _Michel Marcus_ and _Joerg Arndt_, Apr 22 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 3 18:34 EDT 2020. Contains 333198 sequences. (Running on oeis4.)