If that's correct, i'll have more time for explanations later :)$cards -= $holes; # one card per hole is required, # so let's disregard those right away my $r = $cards; my $n = $cards + $holes - 1; my $result = factorial($n) / ( factorial($r) * factorial($n - $r) ); sub factorial { use List::Util 'reduce'; return 1 if $_[0] <= 0; return reduce { $a * $b } 1 .. $_[0]; }
In reply to Re: Combinatorics problem.
by Anonymous Monk
in thread Combinatorics problem. (Updated with more info.)
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |