maths.combinations

https://en.wikipedia.org/wiki/Combination

Functions

combinations(→ int)

Returns the number of different combinations of k length which can

Module Contents

maths.combinations.combinations(n: int, k: int) int

Returns the number of different combinations of k length which can be made from n values, where n >= k.

Examples: >>> combinations(10,5) 252

>>> combinations(6,3)
20
>>> combinations(20,5)
15504
>>> combinations(52, 5)
2598960
>>> combinations(0, 0)
1
>>> combinations(-4, -5)
...
Traceback (most recent call last):
ValueError: Please enter positive integers for n and k where n >= k