You are not logged in.

- Topics: Active | Unanswered

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.

You want to purchase 4 pens, each of a different type, containing at least one of each color.

In how many ways can you do this?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 6,532

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.

You want to purchase 4 pens, each of a different type, containing at least one of each color.

Let's say you have these colours red1, red2, blue1, blue2, blue3, green1, green2, green3, and green4. That's nine colour choices.

So choose a red, then a blue, then a green .... how many ways ?

Then choose anything as the fourth pen out of the 6 remaining choices.

Bob

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Hi Bob

That is not going to yield a correct answer.

Hi Agnishom

Are pens of same color the same or different?

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 6,532

My first attempt at this question interpreted the problem differently. Then I deleted it and tried again. Now I'm not sure. We await Agnishom's clarification.

Bob

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

I'd say the answer is 3 if same-coloured pens are the same and 72 if they are different.

The GFs are:

and

*Last edited by anonimnystefy (2013-09-21 00:18:29)*

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

I think they are different

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

bob bundy wrote:

There are 2 types of red pens, 3 types of blue pens, and 4 types of green pens.

You want to purchase 4 pens, each of a different type, containing at least one of each color.Let's say you have these colours red1, red2, blue1, blue2, blue3, green1, green2, green3, and green4. That's nine colour choices.

So choose a red, then a blue, then a green .... how many ways ?

Then choose anything as the fourth pen out of the 6 remaining choices.

Bob

So, it should be 2*3*4*6 = 144. But why is it 72?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

I already said that isn't correct. If you did it like that, you would count picking red1, red2, blue1, green1 and red2, red1, blue1, green1 as different picks, when they are truly the same.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Hi Agnishom

I checked the answer with them and it is correct.

Here lies the reader who will never open this book. He is forever dead.

Offline

anonimnystefy wrote:

I already said that isn't correct. If you did it like that, you would count picking red1, red2, blue1, green1 and red2, red1, blue1, green1 as different picks, when they are truly the same.

I am sorry, I could not follow. How is it coming to 72?

I too checked that it is correct

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

You can do it by casework or using the GF above.

If you did it by casework you'd do it by choosing one colour and calculating the number of possibilities in which you buy two lens of that colour and one pen of each other colour. Then do that for the two other colour and sum them. The result should be: 1*3*4+2*3*4+2*3*6=72.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

Hmmm.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

I don't know how I would program this one, and it's a simple enough a problem that it doesn't need to be programmed.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

Hmmm.

I don't know how I would program this one

So then it is not so simple. DZ says you do not understand the problem until you program it. This always lends insight and satisfies the "two solution rule."

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

I have two solutions. Classic casework and the GF.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

And if the problem were say 20 pens and 16 to 1 types would you still want to casework it?

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

bobbym wrote:

And if the problem were say 20 pens and 16 to 1 types

What?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

What I am saying is casework is a very clumsy way of working sufficient for small problems only.

You are right, it is difficult to program though.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

I know, I dislike casework, too, but tend to use it if it seems possible.

Have you programmed it?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

Yes I did. But it refuses to get the answer I want.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Can you post the code you currently have?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

```
s = {{r, 1}, {r, 2}, {b, 1}, {b, 2}, {b, 3}, {g, 1}, {g, 2}, {g,
3}, {g, 4}};
ans = Permutations[s, {4}];
ans1 = Select[ans, Length[Union[#[[All, 1]]]] >= 3 &];
ans2 = Select[ans1, Length[Union[#[[All, 2]]]] == 4 &];
Union[Sort[#] & /@ ans2]
```

This is the output

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

The definition of ans2 is incorrect.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,638

What would you do from there?

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

What did you try to do to get ans2, ie. what did you think Select[ans1, Length[Union[#[[All, 2]]]] == 4 &]; would do?

Here lies the reader who will never open this book. He is forever dead.

Offline