addaptic

Reference Combinatorics

lz_combinations

The number of ways to choose the right number of things from the left, n choose k.

long lz_combinations( CLZNumber* leftOperand, CLZNumber* rightOperand, CLZNumber* targetNumber = nullptr );

n! ÷ (k! (n − k)!), exact, worked whole and by the primes of the factorials rather than by dividing them. Choosing more than there are is nought.

Examples

CallAnswer
lz_combinations( 52, 5 )2598960
lz_combinations( 100, 50 )100891344545564193334812497256
lz_combinations( 5, 7 )0

Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also

  • lz_permutations The number of ordered arrangements of the right number of things from the left, n!/(n − k)!.
  • lz_factorial The product of the whole numbers from one to the operand, n!.