COMBINA
Updated 2024-03-01 22:12:05.397000
Syntax
SELECT [westclintech].[wct].[COMBINA] (
<@Number, int,>
,<@Number_chosen, int,>)
Description
Use the scalar function COMBINA to calculate the number of combinations with repetition of n things taken r at a time. The formula is:
C=\frac{\left(n+r-1\right)!}{r!\left(n-1\right)!
Arguments
@Number_chosen
Number to be taken. @Number_chosen must be of type int or of a type that implicitly converts to int.
@Number
Number of things. @Number must be of type int or of a type that implicitly converts to int.
Return Type
float
Remarks
@Number >= @Number_chosen >= 0.
Examples
Example #1
SELECT wct.COMBINA(4, 2) as COMBINA;
This produces the following result.
{"columns":[{"field":"COMBINA","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"COMBINA":"10"}]}
See Also
COMBIN - Combinatorial function
FACTLN - natural logarithm of a factorial
GAMMALN - natural logarithm of the complete gamma function