tags:

views:

45

answers:

3

Say I have a list of 2 colours, Black and White. It's only possible to have 1 combination using these colours, because you can't have two of the same.

If I have 3 colours (Black, White and Red), there are 3 possible combination (Black+White, Black+Red, White+Red).

If I have 4 colours, there are 5 possible combinations and if I have 5 colours there are 10 possible combinations.

I'm trying to work out the relationship between the number of colours and the possible combinations. Here is some data:

Colours Combinations

0 0

1 0

2 1

3 3

4 5

5 10

6 14

A: 

You want the binomial coefficients.

The formula for the number of pairs from a set of size n is n * (n - 1) / 2.

Your values are incorrect. The correct values are:

n   nCr (r=2)
2   1
3   3
4   6
5   10
6   15

This sequence is also known as the triangular numbers.

Mark Byers
Thank you so much! You are right, my values were incorrect. I did double check them, but somehow made the same mistake twice.
Matt
A: 

Read about Combinations

The formula to calculate the value is:

(n!)/(k!(n-k)!)

Where n is the total amount of possible colors and k is how many colors will you pick, so

"1 out of 3" = 3! / 1!*2! => 3*2*1/1*2*1 = 3

and so on...

Vinko Vrsalovic
+1  A: 

Combinations of num_colors taken 2 at a time:

C(n, k) = n!/(k!*(n - k!))

C(0, 2) = C(1, 2) = 0 by definition in your case
C(2, 2) = 2!/(2!*0!) = 2!/2! = 1 (0! is usually 1)
C(6, 2) = 6!/(2!*4!) = 15 (is your 14 a mistake?)

This simplifies to n*(n - 1) / 2 when k = 2.

IVlad