Perl Monk, Perl Meditation  
PerlMonks 
In theory, theory and practice are the same...by tilly (Archbishop) 
on Mar 31, 2001 at 23:32 UTC ( #68698=note: print w/ replies, xml )  Need Help?? 
If you want to understand the math, I fully agree with your use of the formula. Furthermore for more complex combinatorial problems, understand how to get those formulas is extremely important. That said, tye is right as well. While in theory that calculation gets the right answer, in practice it starts to be inaccurate for fairly small numbers. You can get around this by using a big integer package. (Or a language that understands integers of arbitrary size.) But that will be somewhat slow. If you want to understand this, go with the formula. If you want to calculate it, go with the tricks. If you want to calculate answers to arbitrary problems, be prepared to manipulate big integers and hope that performance doesn't matter. And if you want an even better example some day, bug me about why you should always use rowreduction to find the inverses of matrices rather than Cramer's formula. (Hint: Think numerically unstable and exponential running time, vs n**3 and much better behaved.)
In Section
Craft

