Fog Creek Software
Discussion Board




chameleons

Puzzle statement:
"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?"

Ans:

Denote number of Red chameleon by R, Blue by B etc.
Suppose we could convert all the chameleons to Blue

Now Consider R- G.
if a red and a green meet, R - G remains unchanged.
if a red and a blue meet, R - G decreases by 3.
if a green and a blue meet, R - G increases by 3.

i.e R - G always leaves the same remainder when divided by 3.

initially R - G is 2, so R - G can never be 0.
similarly for B - G and R - B.
So not all chameleons can be of the same colour at any time.

Aryabhatta
Thursday, February 13, 2003

excellent solution, Aryabhatta

my "more techie than mathie" way was to state, that
R = 0
G = 1
B = 2
and notice, that CRC3 (SUM % 3) is invariant.

(somehow this solution disappeared from the forum a month or so ago)

Dmitriy
Thursday, February 20, 2003

*  Recent Topics

*  Fog Creek Home