-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed as not planned
Labels
type-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
The Lib/fractions.py is missing the binomial function:
def binomial(n: fractions.Fraction, m :int) :
"""Computs n choose m.
returns n(n-1)(n-2)...(n-m+1) / (1*2*3*...m)
"""
val = fractions.Fraction(1)
for i in range(1,m+1):
val *= n+1-i
val /= i
return val Note that this is not the same as the implementation in the math module: here we want to compute the generalized binomial coefficients which allow numerators to be fractions!
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Metadata
Metadata
Assignees
Labels
type-featureA feature request or enhancementA feature request or enhancement