UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

44 lines (27 loc) 981 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # Function combinationsWithRep Compute the number of ways of picking `k` unordered outcomes from `n` possibilities, allowing individual outcomes to be repeated more than once. CombinationsWithRep only takes integer arguments. The following condition must be enforced: k <= n + k -1. ## Syntax ```js math.combinationsWithRep(n, k) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `n` | number &#124; BigNumber | Total number of objects in the set `k` | number &#124; BigNumber | Number of objects in the subset ### Returns Type | Description ---- | ----------- number &#124; BigNumber | Number of possible combinations with replacement. ## Examples ```js math.combinationsWithRep(7, 5) // returns 462 ``` ## See also [combinations](combinations.md), [permutations](permutations.md), [factorial](factorial.md)