Pascal's Triangle. It has a couple of interactive versions that'll help you visualize what's going on.
Update: I've been looking for a couple of hours, just to satisfy my curiosity, and I finally found it. See Tie::Math under the "How about Pascal's Triangle" section:
#!/usr/bin/perl use Tie::Math qw(f X Y); my %pascal; tie %pascal, 'Tie::Math', sub { if( X <= Y and Y > 0 and X > 0 ) { f(X,Y) = f(X-1,Y-1) + f(X,Y-1); } else { f(X,Y) = 0; } }, sub { f(1,1) = 1; f(1,2) = 1; f(2,2) = 1; }; #'# my $height = 5; for my $y (1..$height) { print " " x ($height - $y); for my $x (1..$y) { print $pascal{$x,$y}; } print "\n"; }
Update: fixed, added comma after "Tie::Math" line 6 and right curly on line 12.
In reply to Re: Equilateral Pascal's Triangle in perltex
by Khen1950fx
in thread Equilateral Pascal's Triangle in perltex
by Coach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |