I am not a mathematician per say, so please forgive me if I am not using the correct terminology.
I have the following question:
I have a set of 6 elements, i.e {1,2,3,4,5,6}. Now, I would like to find out a general formula for the number of combinations if I chose k out of n elements to compare them. In other words how many iteration will I need to cycle from 1 through 6. Note: (1,2) = (2,1) i.e without repetitions. For instance, if I choose three elements at a time, I will need only 5 iterations to compare the elements:
1. (1,2), (1,3), (1,4)
2. (1,5), (1,6), (2,3)
3. (2,4), (2,5), (2,6)
4. (3,4), (3,5), (3,6)
5. (4,5), (4,6), (5,6)
If I choose 4 elements at a time, I will have:
1. (1,2), (1,3), (1,4), (1,5)
2. (1,6), (2,3), (2,4), (2,5)
3. (2,6), (3,4), (3,5), (3,6)
4. (4,5), (4,6), (5,6)
In this case it took 3 full iterations and one partial e.g, total=3.75 iterations. So, I have been trying to come up with a formula for the number of full and partial iterations. Hopefully my questions makes sense, and you could help!
There are $$\frac{n!}{k!(n-k)!}$$ ways to choose a set of $k$ distinct elements from a set of $n$ distinct elements, which is what you have. So, the number of $k$ comparisons is $$\frac{n!}{kk!(n-k)!}.$$