All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Chameleon Island (Posted on 2009-09-25) Difficulty: 3 of 5
On Chameleon Island exists a peculiar sort of chameleon. At any given time any given chameleon is either red, blue or green. When two chameleons of unlike color meet, both immediately change to the remaining possible color.

I scientist has collected 36 of these animals, 12 of each color, and kept them in 36 separate containers to prevent color change, but he wants to keep them in two terraria.

When kept together in small numbers, there's a danger that all the lizards will ultimately go to one color, as exemplified by the following scenario starting out with 1 red, 4 blue and 13 green chameleons. The two letters at the left of each line specify the meeting that changed the count to the one on the given line:


      r  b  g
      1  4 13
rg    0  6 12
bg    2  5 11
rg    1  7 10
rg    0  9  9
bg    2  8  8
bg    4  7  7
bg    6  6  6
bg    8  5  5
bg   10  4  4
bg   12  3  3
bg   14  2  2
bg   16  1  1
bg   18  0  0

From then on, this scenario has all 18 of its chameleons red.

How can the scientist divide his 36 chameleons between the two terraria without posing the possibility of all becoming one color in either terrarium? Assume that no births or deaths occur. There's more than one way.

  Submitted by Charlie    
No Rating
Solution: (Hide)
The only combinations that work have a total number of chameleons that is a multiple of 3. It's also true that when a given set that works is taken from this scientist's collection, the numbers in the remaining set also work, for the other terrarium. So the combinations listed below include, on the left, totals of 18 or fewer, paired with, on the right, the remaining sets of counts of the chameleons that are left. As it doesn't matter which color is which, the numbers are shown in ascending order. As a result, the complementary set on the right will always be the reverse order of whatever colors are represented on the left, as the complements would be expected to decrease in order.

So for example, to read the case of 6 in one terrarium and 30 in the other, an example of the first such line could be considered 0 blue chameleons, 1 red and 5 green, and in the other terrarium, 12 blue, 11 red and 7 green.

0  1  2                     10  11  12

0  1  5                     7  11  12
0  2  4                     8  10  12
1  2  3                     9  10  11

0  1  8                     4  11  12
0  2  7                     5  10  12
0  4  5                     7  8  12
1  2  6                     6  10  11
1  3  5                     7  9  11
2  3  4                     8  9  10

0  1  11                    1  11  12
0  2  10                    2  10  12
0  4  8                     4  8  12
0  5  7                     5  7  12
1  2  9                     3  10  11
1  3  8                     4  9  11
1  5  6                     6  7  11
2  3  7                     5  9  10
2  4  6                     6  8  10
3  4  5                     7  8  9

0  4  11                    1  8  12
0  5  10                    2  7  12
0  7  8                     4  5  12
1  2  12                    0  10  11
1  3  11                    1  9  11
1  5  9                     3  7  11
1  6  8                     4  6  11
2  3  10                    2  9  10
2  4  9                     3  8  10
2  6  7                     5  6  10
3  4  8                     4  8  9
3  5  7                     5  7  9
4  5  6                     6  7  8

0  7  11                    1  5  12
0  8  10                    2  4  12
1  5  12                    0  7  11
1  6  11                    1  6  11
1  8  9                     3  4  11
2  4  12                    0  8  10
2  6  10                    2  6  10
2  7  9                     3  5  10
3  4  11                    1  8  9
3  5  10                    2  7  9
3  7  8                     4  5  9
4  5  9                     3  7  8
4  6  8                     4  6  8
5  6  7                     5  6  7


The program was run with the various n = 3, 6, etc.

DECLARE SUB trace (a!, b!, c!)
CLEAR , , 25000
n = 18

DIM SHARED used(n, n, n)
CLS

used(n, 0, 0) = 1
used(0, n, 0) = 1
used(0, 0, n) = 1
trace n, 0, 0
trace 0, n, 0
trace 0, 0, n

FOR a = 0 TO n / 3
FOR b = a TO (n - a) / 2
 c = n - a - b
 IF used(a, b, c) = 0 THEN
  IF a <= 12 AND b <= 12 AND c <= 12 THEN
   PRINT a; b; c, , 12 - c; 12 - b; 12 - a
  END IF
 END IF
NEXT
NEXT

SUB trace (a, b, c)
 FOR which = 1 TO 3
   SELECT CASE which
     CASE 1
      FOR i = 2 TO a STEP 2
       pa = a - i: pb = b + i / 2: pc = c + i / 2
       IF used(pa, pb, pc) = 0 THEN
        used(pa, pb, pc) = 1
        trace pa, pb, pc
       END IF
      NEXT
     CASE 2
      FOR i = 2 TO b STEP 2
       pb = b - i: pa = a + i / 2: pc = c + i / 2
       IF used(pa, pb, pc) = 0 THEN
        used(pa, pb, pc) = 1
        trace pa, pb, pc
       END IF
      NEXT
     CASE 3
      FOR i = 2 TO c STEP 2
       pc = c - i: pb = b + i / 2: pa = a + i / 2
       IF used(pa, pb, pc) = 0 THEN
        used(pa, pb, pc) = 1
        trace pa, pb, pc
       END IF
      NEXT
   END SELECT
 NEXT
END SUB


Based on a puzzle by Pradeep Mutalik, presented at nytimes.com/tierneylab.

				

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Mind your Mods; Pare your Parityed bottemiller2009-09-25 17:56:59
SolutionThe key to solutionJer2009-09-25 15:27:02
Hints/TipsVery interesting (hints / thoughts)Steve Herman2009-09-25 14:03:26
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information