Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

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'

I'm not crazy, my mother had me tested.

Offline

**bob bundy****Administrator**- Registered: 2010-06-20
- Posts: 8,206

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

Children are not defined by school ...........The Fonz

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

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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

The knowledge of some things as a function of age is a delta function.

Offline

**bob bundy****Administrator**- Registered: 2010-06-20
- Posts: 8,206

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

Children are not defined by school ...........The Fonz

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

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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

The knowledge of some things as a function of age is a delta function.

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'

I'm not crazy, my mother had me tested.

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'

I'm not crazy, my mother had me tested.

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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

The knowledge of some things as a function of age is a delta function.

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

Hi Agnishom

I checked the answer with them and it is correct.

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

The knowledge of some things as a function of age is a delta function.

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'

I'm not crazy, my mother had me tested.

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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.

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hmmm.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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.

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

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.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

I have two solutions. Classic casework and the GF.

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

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.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

bobbym wrote:

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

What?

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

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.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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

Have you programmed it?

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

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.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

Can you post the code you currently have?

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

```
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.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

The definition of ans2 is incorrect.

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

What would you do from there?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,037

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

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

The knowledge of some things as a function of age is a delta function.

Offline