On an island live 34 chameleons, which can take on 3 colors: yellow, red, and green. At the beginning, 7 are yellow, 10 are red, and 17 are green. When two chameleons of different colors meet, they simultaneously take on the third color. It turns out that after a certain amount of time, all the chameleons on the island have taken on the same color. What is this color? (It is necessary to show that it is the only possible one.)
The initial configuration is (7Y, 10R, 17V). We start by noting that all chameleons can be green: this is the case if the 7 yellow chameleons meet red chameleons, then we move to $(0, 3 R, 31 \text{~V})$. Then a red chameleon meets a green one: $(2 Y, 2 R, 30 \text{~V})$. Finally, the 2 yellow and the 2 red chameleons meet: $(0 \text{~Y}, 0 \text{R}, 34 \text{~V})$. It remains to show that green is the only color for which this is possible.

If $x, y, z$ are the numbers of yellow, red, and green chameleons respectively, the remainder in the Euclidean division of $y-x$ by 3 is an invariant. Indeed, depending on the encounters, we will move from $(x, y, z)$ to $(x+2, y-1, z-1)$, to $(x-1, y+2, z-1)$, or to $(x-1, y-1, z+2)$. In the last case, the difference between the number of red chameleons and the number of yellow chameleons does not change. In the first two cases, it decreases or increases by 3. Since at the start, this difference is a multiple of 3, it is true at every step. Since 34 is not a multiple of 3, if all chameleons are unified, they must necessarily be green.