8
0
Given two nonnegative integers n,k
such that 0 <= k <= n
, return the binomial coefficient
c(n,k) := (n!) / (k! * (n-k)!)
Test cases
Most languages will probably have a built in function.
c(n,0) = c(n,n) = 1 for all n
c(n,1) = c(n,n-1) = n for all n
c(5,3) = 10
c(13,5) = 1287
Related challenges
Catalan Numbers Compute the multinomial coefficient Generate Pascal's triangle m-nomial coefficient
4
Surely this is a dup http://codegolf.stackexchange.com/questions/1744/mathematical-combination/9150#9150 or am I missing something?
– Digital Trauma – 2016-12-11T03:31:21.4731I was not aware of that, and I did a thorough search / had it in the sandbox for quite a long time. Too bad it doesn't contain the keyword binomial coefficient... – flawr – 2016-12-11T10:02:09.083