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.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
 a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:

For: 

Use: 
 &   & 
 <   < 
 >   > 
 [   [ 
 ]   ] 
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.

