Combinatorial functions.
The binomial coefficient. binomial(n, m) returns n ! / ((n - m) ! * m !).
n must be a positive integer and m must be a non-negative integer. For convinience, binomial(n, n+i) = 0 for positive i, and binomial(0,0) = 1.
In other cases, it raises an exception.
Return n! for non negative integer n.
Return n-th Bernoulli number.
(new in 0.4.0)
Return n-th Catalan number.
(new in 0.4.0)
Generate indeces of m elment subsets of n element set.
For example:
>>> for idx in combinationIndexGenerator(5,3): ... print idx ... [0, 1, 2] [0, 1, 3] [0, 1, 4] [0, 2, 3] [0, 2, 4] [0, 3, 4] [1, 2, 3] [1, 2, 4] [1, 3, 4] [2, 3, 4] >>>
(moved from zassenhaus.py in 0.5.0)
Return the falling factorial; n to the m falling, i.e. n(n-1)..(n-m+1).
(new in 0.5.0)
Return the rising factorial; n to the m rising, i.e. n(n+1)..(n+m-1).
(new in 0.5.0)
Return multinomial coefficient.
parts MUST be a sequence of natural numbers and n==sum(parts) holds.
(new in 0.5.0)
Generate partitions of n.
If maxi is given, then addends are limited to at most maxi.
(new in 0.5.0)