# Mathematics question

10 replies [Last post]
questccg
Offline
Joined: 04/16/2011

I have a rather simple math question:

If I have five (5) colors and use them four (4) times, how do I compute the UNIQUE number of combinations.

An example:

If I choose two (2) colors = Green and Black. I get duplicates like:

GGKK = GKGK = KGKG = GKKG = KGGK or

GKKK = KGKK = KKGK = KKKG

Can somebody help me in knowing how to mathematically calculate the UNIQUE count???

JTAshby
Offline
Joined: 12/07/2014
A combination to start...

If you're looking to get rid of any replicates, a combination would be the way to go.

http://www.mathsisfun.com/combinatorics/combinations-permutations.html

Do you have duplicates of your colors when choosing, as your example above? If you do, it might require a bit more work, but I can look into it further.

questccg
Offline
Joined: 04/16/2011
Combination - but how to get UNIQUE???

JTAshby wrote:
If you're looking to get rid of any replicates, a combination would be the way to go.

Well duplicates like Green-Green-Black-Black is still identical to Black-Black-Green-Green.

In BOTH cases there are 2 Green and 2 Black.

JTAshby wrote:
Do you have duplicates of your colors when choosing, as your example above? If you do, it might require a bit more work, but I can look into it further.

Well I have five (5) colors (n=5) and want to pick four (4) (r=4) of them.

BUT I don't know HOW to eliminate duplicates (as I mentioned above) :(

This is a *Tricky* problem...

JTAshby
Offline
Joined: 12/07/2014
When you say 5 colors...

When you say 5 colors, do you mean 5 different colors (aka grabbing from RYGBW out of a bag, for instance, with one of each color in the bag, or are there multiples of each color? if so, how many multiples are there of each color, potentially?

SLiV
Offline
Joined: 10/21/2011
Binomials

It took me a bit of tinkering but I think this is right: if you have N colors and you want to take K of them, there are "N+K-1 choose K" = (N+K-1)! / (K! * (N-1)!) possibilities. Here ! means factorial, so K! = K * (K-1) * ... * 2 * 1.

So in your case the answer would be 8! / (4! * 4!) = 70 possibilities.

JTAshby
Offline
Joined: 12/07/2014
That'd be the one!

I was looking at that one as well. I think that assumes that you have enough of each color to draw them an infinite amount of times, but it should work if there are enough of each color being chosen from.

questccg
Offline
Joined: 04/16/2011
JTAshby wrote:When you say 5

JTAshby wrote:
When you say 5 colors, do you mean 5 different colors (aka grabbing from RYGBW out of a bag, for instance, with one of each color in the bag, or are there multiples of each color? if so, how many multiples are there of each color, potentially?

There are five (5) colors and I want to compute UNIQUE combinations of four (4) of them. So my colors are: Red (R), Green (G), Blue (B), White (W) and Black (K).

So there are MULTIPLEs of each color. so four (4): Green, Green, Green, Green is okay. And Black, Black, Black, Black is also okay.

But when you do Green + Black (mixed), you need to remove combinations so that they are unique. So Green, Green, Black, Black is okay.

BUT KKGG, GKGK, KGKG, KGGK, GKKG are NOT okay.

Because it works out to be 2x two (2) colors.

questccg
Offline
Joined: 04/16/2011

SLiV wrote:
...So in your case the answer would be 8! / (4! * 4!) = 70 possibilities.

Whoa thanks - that is quite the formula. Would have never figured that one out myself...

Much gratitude SLiV and JTAshby!!!

questccg
Offline
Joined: 04/16/2011
Duplicates

I knew that 5 x 5 x 5 x 5 = 625 is the total amount of combinations.

What I could not figure out, is how to remove the duplicates...

Thanks again!

BTW does anyone know a site that can allow you to compute all 70 possibilities. I know 70 isn't HUGE - but it's quite a bit - I may try to compute them manually and see how that turns out.

Keep you all posted!

JTAshby
Offline
Joined: 12/07/2014
I just found this guy

http://www.mathsisfun.com/combinatorics/combinations-permutations-calcul...

save you a bit of time, if you haven't done it already...

nand
Offline
Joined: 07/27/2008
With my software (nanDECK)

With my software (nanDECK) non only you can compute the number of combinations, but you can use them in drawing the cards.

In your example, this line creates a sequence of all the combinations (order doesnâ€™t matter) of five elements, taken by groups of four (there are 70 results):
cr[list]4=R|G|B|W|K

This line is for the permutations (order matters), there are 625 results:
pr[list]4=R|G|B|W|K

The same, but removing the same results (these are 165):
prx[list]4=R|G|B|W|K

And with these two lines, you can print them on a deck of cards:

font=arial,32,,#000000
text=1-{(list)},[list],0,0,100%,100%