> > Mathematically, `binomial(n, k)` for `k > n` is defined as 0.
>
> It's not so clear cut. You can find different definitions out there.
> Knuth et. al., for example, in the book "Concrete Mathematics", extend
> the definition not just to negative k, but to negative n as well.
> Mathematicians aren't very good at agreeing on things. :-)
I think the key word there is *extend*. To the degree that any
mathematical definition is "obvious", the obvious definition for number
of combinations ("n choose r") is going to be 1 for r == 0 and 0 for r > n.
However, I think that it is too easy to get the order of n and r (n and
k) mixed up, and write combinations(5, 10) when you wanted to choose 5
from 10. I know I make that mistake on my calculator *all the time*, and
so do my students, even with the nPr notation. So I recommend we raise
ValueError for r > n. |