On an island, there are magical sheep. There are 22 blue ones, 18 red ones, and 15 green ones. When two sheep of different colors meet, they both turn the third color. Is it possible that after a finite number of encounters, all the sheep will be the same color? If so, what could this color be?
Here, the allowed transformations are three: one can go from $(b, r, v)$ to $(b-1, r-$ $1, v+2),(b-1, r+2, v-1)$ or $(b+2, r-1, v-1)$. In particular, one can notice that $r-v(\bmod 3)$ is constant, and equals 0 in the initial position. If after the encounters all the sheep were red or green, one would have 55 sheep of one color and 0 of the other, and the difference would be 1 or $-1(\bmod 3)$, which is impossible. The only possible final color is therefore blue. Indeed, by making a blue sheep and a red sheep meet, then 17 times a red sheep and a green sheep, all the sheep become blue. Note that the construction (or a proof of existence) is important, the fact that an invariant is constant between two positions does not guarantee that one can go from one to the other.