Skip to content

binomial

Subhajit Sahu edited this page Aug 9, 2022 · 1 revision

Find the number of ways to choose k elements from a set of n elements.

Similar: factorial, binomial, multinomial.


function binomial(n, k)
// n: elements in source set
// k: elements in choose set

const xbigint = require('extra-bigint');


xbigint.binomial(4n, 1n);
// → 4n

xbigint.binomial(4n, 2n);
// → 6n

xbigint.binomial(4n, 3n);
// → 4n


References

Clone this wiki locally