in reply to Binomial Expansion
A pattern? Yes, of course!
Here what you can obtain if you paint a Pascal Triangle.
Here what you can obtain if you paint a Pascal Triangle.
Update I think this link could be amusing: Pascal's Triangle
#!/usr/bin/perl use strict; my $n = 10; for my $i (0 .. $n) { for my $j (0 .. $i) { my $coefficient = nCr($i, $j); if ($coefficient % 2) { print '#'; } else { print ' '; } } print "\n"; } # returns n!/r!(n-r)! sub nCr { my $n=shift; my $r=shift; return int nFactorial($n) / int nFactorial($r) * int nFactorial($n +-$r); } # like the name says, n! sub nFactorial { my $n=shift; my $product = 1; while($n>0) { $product *= $n--; } return $product; }
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: Sierpinskij (Re: Binomial Expansion)
by tye (Sage) on Mar 29, 2001 at 21:13 UTC | |
Re: Sierpinskij (Re: Binomial Expansion)
by rpc (Monk) on Mar 29, 2001 at 23:10 UTC | |
Re: Sierpinskij (Re: Binomial Expansion)
by oha (Friar) on Dec 19, 2003 at 20:05 UTC |
In Section
Craft