Created
August 12, 2020 15:50
-
-
Save JacobLinCool/27e8e016462c8cbf6fa1f6e72ca593b9 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
// Factorial | |
function F(n){ | |
let sum = 1; | |
for(let i = 1; i <= n; i++) sum *= i; | |
return sum; | |
} | |
// Permutation | |
function P(a, b) { | |
return (F(a) / F(a-b)); | |
} | |
// Combination | |
function C(a, b) { | |
return (P(a, b) / F(b)); | |
} | |
// H | |
function H(a, b) { | |
return C(a+b-1, b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment