# Are there examples where mathematicians needs to calculate big combinations

With the $C_n^k$ formula, I managed to optimize it for finding very big numbers such as $C_{7130}^{7125}$ rather quickly. I could have used GMP or Ruby because unsigned long don't hold a lot of values, but here is my question:

Are there applications where people need to compute such numbers ? Because the plain factorial methods can be quite long compared to my method...

-
Have you already checked your formula/algorithm against those provided by most mathematical programming packages? (Matlab, Mathematica, R, etc...) –  Raskolnikov Apr 22 '11 at 12:44
...or this one, which is similar: numbertheory.org/php/binomial.html –  Hans Lundmark Apr 22 '11 at 17:51

Yes, there are all sorts of reasons why you might want to know a large binomial coefficient. Is this what you have?

some_int_type nCr = 1 ;
if (r > n/2) r = n - r ;
for (int i = 1 ; i <= r ; i++, n--)
nCr *= n, nCr /= i ;

-
yes, except the characters aren't in that exact order. –  jokoon Apr 22 '11 at 18:50
WELL THEY SHOULD BE! –  TonyK Apr 26 '11 at 15:35