Chameleons

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?”


Solution

I haven’t written up a solution for this yet, but smarter people than I have described some on the discussion forum. You can read their thoughts here.

2026 Update: Invariants and Impossibility Proofs

The Chameleons puzzle (three groups of chameleons; when two of different colors meet they both change to the third color — can all chameleons ever be the same color?) is solved by finding an invariant that proves impossibility for most starting conditions.

The invariant: After any meeting, the difference between the counts of any two color groups changes by exactly 3 (one group loses 2, one gains 2, one is unchanged — so pairwise differences mod 3 are preserved). This means all chameleons can be the same color only if the initial counts are all equal mod 3, i.e., all three counts differ by multiples of 3, reducing to all three counts being equal.

Python verification:

def can_unify(r, g, b):
    """
    Can all chameleons become one color?
    Necessary condition: all three counts must be equal mod 3.
    (Because each meeting preserves counts mod 3.)
    """
    return (r % 3 == g % 3 == b % 3)

# Test cases
print(can_unify(13, 15, 17))  # False - 13%3=1, 15%3=0, 17%3=2
print(can_unify(10, 10, 10))  # True  - all equal
print(can_unify(1, 6, 2))     # False - 1%3=1, 6%3=0, 2%3=2

Why this matters in 2026: Impossibility proofs via invariants are crucial in distributed systems. The CAP theorem, FLP impossibility result (no asynchronous system can be both safe and live in the presence of faults), and two-generals problem are all proven via invariant arguments. If you understand chameleons, you understand the reasoning pattern behind these foundational CS results.

Scroll to Top