Fog Creek Software
Discussion Board




chameleons question (any ideas???)

Assuming there are x number of reds, y number of greens and z number of blues, in order for all of them to become the same color, the value of x,y,z have to fulfill the condition of:
x+y=2z
x+z=2y
y+z=2x

The obvious set of values that fulfills these 3 equations is of course x=y=z

This is too obvious, do you guys have any thoughts?

Howard Chu
Monday, May 23, 2005

This forum main page shows only limited number of topics...
http://discuss.fogcreek.com/techinterview/default.asp?cmd=search&q=chameleons

DK
Monday, May 23, 2005

No.
Initially all the numbers have different remainders when divided by 3. I.e. the difference in remainder between any pair of colors is not 0.

For all chameleons to have the same color, two numbers must be 0, which means a difference of 0 between their remainders.

It remains to be shown that the only possible operation (pairing to chamelons) does not change differences between remainders:

The two colors that are paired are both reduced by the same number (1), therefore their difference and thus their difference in remainders does not change.

As for the difference between a paired color and a resulting color: one decreases by 1, tho other increases by two, which is a difference of 3 which does not change the remainder when dividing by 3.

Gerhard
Friday, May 27, 2005

I came up with the same answer for similar reasons, but by a slightly different route.

For any combination of exchanges (I notate an exchance toward red with R, green with G, blue with B), the populations are:

Red population = 13 + 2R - B - G
Blue population = 17 + 2B - R - G
Green population = 15 + 2G - R - B

If you substitute 45, 0 and 0 for the populations and solve for the exchanges, you will quickly get

B = R - (49/3)

or something similar which means either B or R is not an integer. So the population cannot become all red.

Similar results for the other two colors prove the answer.

Jesse Millikan
Tuesday, June 21, 2005

*  Recent Topics

*  Fog Creek Home