chameleons the answer is simple the equation should be 2X + Y = 45 Where Y is odd. If we can achieve it then problem is solved. Look at number now: 13 red chameleons 15 green chameleons 17 blue chameleons Every time they meet (opposite color) they will end up either all even or all odd. say red and green meets 12 red chameleons 14 green chameleons 18 blue chameleons The above equation can never be true i.e. 2X + Y = 45 where we need two even and one odd. So it is not possible to achieve it. Ratan Monday, April 26, 2004 Original quiz it at location: http://www.techinterview.org/Puzzles/chameleons.html Ratan Monday, April 26, 2004 It is possible 13 red chameleons 15 green chameleons 17 blue chameleons Assume that a green chameleon meets a blue chameleon and changes color to a red chameleon. So after this, the numbers are changed as 14 red 14 green 16 blue After this 14 red chameleos meets 14 green ones individually and eventually you have 30 blue chamelons Mahesh Tuesday, April 27, 2004 Just to clarify, two chameleons do not meld into one chameleon.  All they do is change color.  So the number of chameleons would stay the same, hence forty five chameleons would not end up to be thirty chameleons. In the first post, if a red chameleon meets a green chameleon, you would end up with two more blue chameleons.  The numbers should look like this: 13 red chameleons 15 green chameleons 17 blue chameleons red meets green 12 red chameleons 14 green chameleons 19 blue chameleons JHY Tuesday, April 27, 2004 Enumerate the colors -- say red=0, green=1, blue=2. Construct the sum:S= 0*Nred + 1*Ngreen + 2*Nblue. S%3(mod3) is a constant, since it remains the same for each pair: (0+1)%3 = (2+2)%3, (0+2)%3 = (1+1)%3, (2+1)%3 = (0+0)%3. Initially S=0*14+1*15+2*16, and S%3=2, while for 45 of the same color S%3 would be 0. Done. DK Saturday, May 01, 2004 It's not possible, because the distribution of the chameleons is such that they are separated by two.  Every time two different colored chameleons change colors, one of the colors goes up by 2, and the other two colors go down one each.  Because of this, no two colors will ever have the same number of chameleons at the same time.  The numbers will just keep dancing around each other. eliza s Thursday, June 10, 2004 mahesh u great, so is the chameleons deepa v Thursday, July 01, 2004 My instinct is exactly the same as Mahesh.  There must be something wrong here, otherwise it's too easy for adult. Steve Li Thursday, July 01, 2004 Two chameleons dont meld into one. duh Mohammed Saiyad Wednesday, July 14, 2004 Initial difference between green and red hameleons is  Diff(green,red)=numOfGreen-numOfRed=-2 It's obvious, that after each meeting of hameleons, the value of Diff(green,red) - remains unchanged or Diff+=3 or Dif-=3. In that case, it's obvious too, that the value of Diff(green,red) can't become zero. Sergey N. Sokolov Thursday, July 15, 2004 Never Converges..... Although, not acceptable by true mathematical standards... here's my proof by example ;-) Consider a scaled down version of the problem: 1 Red (R), 3 Green  (G), 5 Blue (B) R  G  B 1  3  5 0  2  7 -------- 4  0  5 0  8  1 2  7  0 -------- 0  5  4 8  1  0 7  0  2 -------- 5  4  0 1  0  8 0  2  7 -------- Notice how the same numbers keep getting exchanged among the different colors. The dottec lines are to show sets of repeating patterns. Awaiting comments :-) EE/ CS Guy Friday, July 23, 2004 It is obviously capable of happening.  Here is step by step proof: It is easily possible. Score: 13 Red Chameleons, 15 Green Chameleons, 17 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 12 Red Chameleons, 14 Green Chameleons, 19 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 11 Red Chameleons, 13 Green Chameleons, 21 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 10 Red Chameleons, 12 Green Chameleons, 23 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 9 Red Chameleons, 11 Green Chameleons, 25 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 8 Red Chameleons, 10 Green Chameleons, 27 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 7 Red Chameleons, 9 Green Chameleons, 29 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 6 Red Chameleons, 8 Green Chameleons, 31 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 5 Red Chameleons, 7 Green Chameleons, 33 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 4 Red Chameleons, 6 Green Chameleons, 35 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 3 Red Chameleons, 5 Green Chameleons, 37 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 2 Red Chameleons, 4 Green Chameleons, 39 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 1 Red Chameleons, 3 Green Chameleons, 41 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 0 Red Chameleons, 2 Green Chameleons, 43 Blue Chameleons 1 Green Chameleons and 1 Blue Chameleons meet Score: 1 Red Chameleons, 1 Green Chameleons, 43 Blue Chameleons 1 Red Chameleons and 1 Green Chameleons meet Score: 0 Red Chameleons, 0 Green Chameleons, 45 Blue Chameleons Red Chameleon Wednesday, September 01, 2004   Fog Creek Home