Created
May 20, 2015 10:47
-
-
Save kungfuant/c865b8caf4bac568307a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function binom(n,k) { | |
k = Math.min(k, n - k); | |
assert(k >= 0); | |
var r = 1; | |
for (var i = 0; i < k; ++i) | |
r = (r * (n - i)) / (i + 1); | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment