Waseem Yusuf c0e87c4b71 Make combinationsWithRep.js more efficient (#1602)
* Implemented the `multicombinations` function

* Write unit tests for `multicombinations` function

* Integrate the `multicombinations` function throughout codebase

1. Include multicombinations factory function in factoriesAny.js and factoriesNumber.js
2. Write embedded docs for multicombinations
3. Added latex support
4. Refer to multicombinations in the "see also"-section of related functions

* Change name from `multichoose` to `combinationsWithRep`

* Update combinationsWithRep.js

Instead of always cancelling `n-1 factorial` from the denominator and ignoring `k factorial`, added a conditional to cancel the the larger of the two, therefore further reducing redundant calculations.

* Revert "Update combinationsWithRep.js"

This reverts commit efef6d3bd4c381aa12f00869a7624a622268805c.

* Update combinationsWithRep.js

Instead of always cancelling `n-1 factorial` from the denominator and ignoring `k factorial`, added a conditional to cancel the the larger of the two, therefore further reducing redundant calculations.

* Add one more test for the case: k > n-1

* Refactor single for-loop into two separate ones
2019-08-28 15:10:24 +02:00
..