Combina
Combina-func
Description
Minimum Origin Version Required: 2019 SR0
This function is used to calculate the number of k-combinations (with repetitions) from a given set with n elements, denoted by:
Please note that it counts the repetition as a possible combination, which is different from the Combine function. For example, in a set of 3 elements of "a, b, c", there are 3 combinations for 2 elements without repetitions (calculated by the Combine function): ab, ac, bc. But if take repetitions into account, there are 6 combinations (calculated by the Combina function): aa, ab, ac, bb, bc, cc.
Syntax
double Combina(int n, int k)
Parameters
n
- The number of elements in a given set. It must be a positive integer.
k
- The k-combinations. It must be a positive integer and k < n.
Return
Return the number of k-combinations (with repetitions) from a given set with n elements.
Example
combina(4, 2) = ; // returns 10
Combina(8, 2) = ; // returns 36
See Also
Combine, Permut, Permutationa
|