Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have small problem that could be solved with a mathematical calc, but I don't know how.

I have six variables String , and I must find all the combination between them.

Obvisually , in every combination, the same string can't appear!

Example:

In these example, I tried to find the combinations for the first column. i don't know if it's right.

white, yellow , red, black, blue

 white, yellow
 white, yellow , red
 white, yellow , red,black,
 white, yellow , red,black, blue, 
 white, red, black, blue
 white, black , blue
 white, blue 
 white black, 

... and so on...

How can i have a algorithm to calc this stuff?

share|improve this question
    
Possible duplicate: math.stackexchange.com/questions/141302/… –  Julian Kuelshammer Nov 7 '12 at 16:14

1 Answer 1

If you don't care in which order the colors appear, then each color can either be part of a subset, or not.

This gives $2^6$ subsets, but it includes the empty set, which may not be interesting for you.

Take it out to get

$$ 2^6-1=63 $$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.