3.5.1.1.3 CombinaCombina-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:
/math-5586fa69635d49f4e33f0bec2a64b433.png?v=0)
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
|