Statistics: combinations in Python

Posted by Morlock on Stack Overflow See other posts from Stack Overflow or by Morlock
Published on 2010-06-11T18:13:16Z Indexed on 2010/06/11 18:23 UTC
Read the original article Hit count: 361

Filed under:
|
|

I need to compute combinatorials (nCr) in Python but cannot find the function to do that in 'math', 'numyp' or 'stat' libraries. Something like a function of the type:

comb = calculate_combinations(n, r)

I need the number of possible combinations, not the actual combinations, so itertools.combinations does not interest me.

Finally, I want to avoid using factorials, as the numbers I'll be calculating the combinations for can get to big and the factorials are going to be monstruous.

This seems like a REALLY easy to answer question, however I am being drowned in questions about generating all the actual combinations, which is not what I want. :)

Many thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about statistics