King Octopus has servants with six, seven, or eight legs. The servants with seven legs always lie, but the servants with either six or eight legs always say the truth.

One day, 4 servants met:

The blue one says: “Altogether we have 28 legs”;

The green one says: “Altogether we have 27 legs”;

The yellow one says: “Altogether we have 26 legs”;

The red one says: “Altogether we have 25 legs”.

What is the colour of the servant that is speaking the truth?

The green one is telling the truth.

Lets assume that one of them is telling the truth and then try to prove that. Since all four servants are disagreeing then 3 of them must be lying.

The servant telling the truth will have either 6 or 8 legs. The other 3 servants will have 7 legs since they lie. So the total number of legs should be either 27 (6 + 7 + 7 + 7) legs or 29 (8 + 7 + 7 +7) legs. Only green servant could be telling the truth as it said 27 legs.

Alternatively, let’s say blue is telling the truth: so the blue one has either 6 or 8 legs. And each of the other octopuses are lying hence have 7 legs each. So our total number of legs: 6 + 7 + 7 + 7 = 27 legs or 8 + 7 + 7 + 7 = 29 legs. But since blue said that altogether they have 28 legs, we know he is lying.

If you follow this same logic for all of them, you realize that only the green octopus can be telling the truth as the number of legs adds up.