ZCubes/Pascal vs Sierpinski Triangle

Revision as of 00:08, 11 March 2021 by Jayaram (talk | contribs) (→‎Code-Pascal vs Sierpinski Triangle)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Pascal vs Sierpinski Triangle


This video demonstrates how to generate Pascal triangle in Z and derive Sierpinski triangle from Pascal triangle in ZCubes.

Video


Pascal vs Sierpinski Triangle














Code-Pascal vs Sierpinski Triangle

   m=10;
   pt=PASCALTRIANGLE(m);
   a=pt
      .map(
       function(r,i)
        {
         var prefix=(REPEATCHAR(" ",(2*m-(2*i+1))/2).split(""));
           return(
                prefix
                 .concat(r.join(", ,").split(","))
                 .concat(prefix)
            )
        }
     );
 (a);


 m=32;
 pt=PASCALTRIANGLE(m);
 m=10;
 pt=PASCALTRIANGLE(m).$(x=>x%2)
 a=pt
     .map(
      function(r,i)
      {
         var prefix=(REPEATCHAR(" ",(2*m-(2*i+1))/2).split(""));
           return(
                prefix
                 .concat(r.join(", ,").split(","))
                 .concat(prefix)
           )
      }
   );
 (a);


 m=64;





© Copyright 1996-2021, ZCubes, Inc.