Fog Creek Software
Discussion Board

chameleons -- solution

chameleons  aha:!

"at one point, a remote island's population of chameleons was divided as follows:

13 red chameleons
15 green chameleons
17 blue chameleons

each time two different colored chameleons would meet, they would change their color to the third one. (i.e.. If green meets red, they both change their color to blue.) is it ever possible for all chameleons to become the same color? why or why not?"

Because 'why not' is asked, it should be not possible for all chameleons to become the same color.

Here is why:
For any two kinds of chameleons to disappear,
1>they should be of the same number, or
2>the difference in their number should be 3, or a factor of 3 (6, 9, 12, ...).

Say we have 3 red ones, 0 blue, and the rest are green.
Take 1 red and 1 green will turn into 2 blue, so we will have 2 red and 2 blue left, like in case 1, when red and blue ones meet, they will change to green.

The initial numbers are 13, 15, and 17, so difference in either 2 kinds are 2, or 4, no factors of 3, ==>

It is not possible for all chameleons to become the same color

Pan, Wenyu
Tuesday, September 24, 2002

The answer of course is yes, and the reason is that there are an odd number of chameleons.

Imagine that there are three chameleons, one red, one blue, and one green. When two different coloured chameleons meet they both change colour to that of the third one, and are thus the same colour.

The point is that all the extra chameleons don't matter. All that matters is that there will always be a third one.

This is exactly like Levik's other problem of the crazy airplane passenger. All you need to do is to forget about the intermediate irrelevant stages.

Stephen Jones
Thursday, October 24, 2002

Shouldn't be looking at these so late at night!

You're correct. It can't be done because there is no way to get two colors of chameleons to have the same number.

Stephen Jones
Thursday, October 24, 2002

*  Recent Topics

*  Fog Creek Home