On Mon, Mar 23, 2020 at 5:13 AM Neil Girdhar <mistersh...@gmail.com> wrote: > > I mean: > > def binom(n, *ks): > # Check that there is at least one ki, and that their sum is less than n, > and that they are all nonnegative. > # Returns n! / (prod(ki! for ki in ks) * (n-sum(ks))!) > > This would still work for binom(n, k), but would also work for the mulinomial > case. >
Thanks for pulling this up again. I actually would have very much liked to have an efficient and accurate binom(n,k) function available - everything I could find was either floating-point (with the limitations thereof) or too inefficient to be used for ridiculously large values of n and/or k. +1 on moving forward with adding an imath module. ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2LGYCYCDZGGZKMFAWBKBS2NWGDIRPAIJ/ Code of Conduct: http://python.org/psf/codeofconduct/