What is the function to find a set of ordered values in a random set?

23 Views Asked by At

Given a set of discrete ordered values, what are the amount of combinations of n values within that set?

Such as;

Given the set [1,2,3,4,5] and choose n = 3, the total combinations are

[1,2,3] [1,2,4] [1,2,5] [1,3,4] [1,3,5] [1,4,5] [2,3,4] [2,3,5] [2,4,5] [3,4,5]

What would the function be such as f(m, n) where m is the total count of elements. And n is the amount to chose?

2

There are 2 best solutions below

0
On

You are looking for the binomial function. Also called the "Choose" function.

0
On

It is $$\binom{n}{m}=\frac{n!}{m!(n-m)!}$$