combinations top-level property

MemoizedFunction2<BigInt, BigInt, BigInt> combinations
final

Returns the number of k-combinations of n distinct objects. More formally, let S be a set containing n distinct objects. Then the number of subsets containing k objects is given by combinations(n, k).

  • combinations(n, n) = 1
  • combinations(n, k) = combinations(n, n - k)
  • combinations(n, 0) = 1 Throws an error of type ArgumentError if a negative argument is provided or if n < k.

Implementation

final combinations = MemoizedFunction2(_combinations);