Algosim documentation: combinations

combinations

Returns binomial coefficients.

Syntax

Description

combinations(n, k) is the binomial coefficient n!/(k!⋅(n−k)!).

combinations(n, k) is the coefficient in front of x^k in the expanded form of (1 + x)^n. It is also the number of distinct k-sized subsets of a set of cardinality n.

Examples

combinations(70, 10)
396704524216
succeeded(for(n, 1, 50, assert(∑(combinations(n, k), k, 0, n) = 2^n)))
true

See also