# Logic puzzle: Which octopus is telling the truth?

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 tell the truth.

One day, four 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 who tells the truth?

-
I like the question "How many legs do the servants have altogether?" better, since it doesn't give away that exactly one is telling the truth. –  thethuthinnang Feb 16 at 0:12
If you enjoyed this puzzle, may I shamelessly plug the Puzzling proposal in Area51? –  IQAndreas Feb 16 at 4:46
I can see what color they are, but I can't count their legs? –  Russell Borogove Feb 16 at 22:13
@RussellBorogove Count the legs? Good luck. –  WChargin Feb 17 at 0:32
@thethuthinnang Not much difference: with four different answers, obviously only one can be telling the truth. –  Sebastian Redl Feb 17 at 18:00

Hint: since they all disagree, at least three are lying. How many legs does that account for?

-
Very nice hint! –  ShreevatsaR Feb 15 at 17:04
And additionally, exactly three lie, since the question asks about the truth teller. –  nbubis Feb 15 at 23:03
@nbubis that is irrelevant, since if all 4 were lying, there would be exactly 28 legs, which is what the blue one said, which means the blue one was not lying, which means only 3 were lying... –  AviD Feb 16 at 12:12
I'm no longer voting via my iPad. I'm sorry I am the DV, by accident of course, and unlike typos, I can't reverse, unless answer is edited. Not the first time this has happened. –  JoeTaxpayer Feb 18 at 15:04

Well The Green one?

Since the four are disagreeing then $3$ must be lying. Since only octopuses with 7 legs lie then there must be $7\times3 = 21$ legs.

That leaves the honest octopus with either $6$ or $8$ legs. So the total number of legs should either be $21+6= 27$ legs or $21+8=29$ legs.

Since no one says that they have $29$ legs then only the Green octopus is saying the truth.

It seems to be simple unless I missed something in the riddle.

-
(To be picky, the servants are not necessarily octopuses...) You can also solve the problem without assuming there is an honest servant among the four, because if all four were lying, there would be $28$ legs, and the blue one couldn't be lying. –  Steve Kass Feb 15 at 20:28
To be even more picky, the servants didn't say if "altogether we" included the Octopus King or not, and if they did, how many legs the King had. –  Mr Lister Feb 16 at 15:17
@MrLister well if you are going to be really picky, they don't specifically say that they are talking about their own legs. They could be talking about frog legs they are preparing for the king to eat... –  Michael Feb 18 at 20:55

This is more fundamental than it seems. The way the octopod nervous system works is different from ours. They have no body image, and their legs send no signals back to their brain. So an octopus can only know how many legs other octopuses have. So they can only be sure about what the others say. This means that the only octopus who can have an accurate picture is the one with the most information - the red octopus.

As has been pointed out, the only option with one true answer is 3*7 + 1 * 6.

The first three octopuses don't know how many legs they, in fact, have, but the fourth octopus knows that the green one has six legs, and sees that the other two have seven, so he knows that there he has seven legs, so he knows he has to lie.

The only octopus that knows the truth is the red one, so the only octopus that actually lies is the red one. The other three do their best, but they cannot know the truth.

-
You mean the first one, who sees a total of 20 legs on the others, guesses that he himself has 8 legs and so says 28, because that would have been the true answer if he did have 8 legs? Yes, makes sense. –  Mr Lister Feb 17 at 10:45
Why wouldn't an Octopus simply be able to see how many legs they have? –  Martin Smith Feb 17 at 12:08
They can only see two or three legs if they are in front of their eyes. They have no direct control over their legs, so it isn't clear that they can move their legs in front of their eyes, and they don't have mirrors. –  Peter Brooks Feb 17 at 12:56
"So an octopus can only know how many legs other octopuses have." Since we've suspended reality enough to have talking octopusses, who's to say these four haven't asked a truth-telling companion how many legs they have... –  Julia Hayward Feb 18 at 13:30
This answer might ought to be labeled as a "what-if" scenario, as opposed to "the answer", so as not to confuse the unwary... –  LarsH Feb 18 at 14:30

If all are liars then they are all 7 legged and the total number of legs would be 28. As the blue octopus says the total is 28 this a contradiction. Therefore at least one is telling the truth.

If at least 2 are telling the truth then there should be at least 2 answers the same. Since there are no same answers therefore only one can be telling the truth.

With one telling the truth which is either 6 or 8 legged and 3 liars, if there are 29 legs then the 8 legged octopus is telling the truth but since there is no 29 legs answer then the green 6 legged octopus is telling the truth.

-

The Red one ;)

To see this, let's analyze a why the 6, 7, and 8-legged octopuses behave the way they do. Clearly it is because the punishment for lying is amputation of a limb for subservience. This perfectly explains why 7 legged octopuses lie and the others tell the truth.

To explain, given the fact that 6 legged octopuses never lie, this is obviously because they have learned from experience the dire consequences of lying and will never repeat that mistake again. 8-legged octopuses, on the other hand, have the reputation of perfectly honest citizens and thus retain the highest honor. They are afraid to lose that honor in the Octopus's Garden, and thus want to keep it that way. However, 7-legged octopuses are always pre-judged as liars, and thus are treated the worst. Thus, in order to be elevated to second-class 6-legged citizens, they always lie to get one of their legs chopped off.

Thus, the meeting went something like this with the missing information added:

One day, four servants met.
The blue one says: "Altogether we have 28 legs";
- One of his 7 legs is immediately amputated for lying
the green one says: "Altogether we have 27 legs";
- One of his 7 legs is immediately amputated for lying
the yellow one says: "Altogether we have 26 legs";
- He lies, and the amputator raises the axe, but before he can speak,
the red one quickly says: "Altogether we have 25 legs".
- He tells the truth, and keeps his 6 legs.
- The axe completes it's ark, amputating the 7th leg of the yellow octopus

-
Yeah, I thought the "green" answer seemed too easy. Thanks for uncovering the real truth of the matter! –  Richard Venable Feb 17 at 23:08
I suppose allowing self-amputating octopi after they make their statement adds new dimensions. But who said they lose precisely one leg for lying? –  smci Feb 19 at 11:50

the green one says: "Altogether we have 27 legs";

3*7 + 1*6 its the only combination where only one is telling the truth ... if all otheres have 7 legs, they will lie and thus green tells the truth ....

-
Impossible. 8 + 6 would mean that 2 ppl tell the trueth, thus you would create a contradiction ... you can only have 1 who tells the truth and need 3 that a lying .. thus 3*7 + 1x = 25,26,27 or 28 where x can be 6 or 8 ... and so only 6 is valid for x ... its only 1 solution possible .. and thats it :) –  Umingo Feb 16 at 14:09

The Green Hexa-pus is telling the truth.

First we will figure out how many are telling the truth:

If there is more than one octopus telling the truth we would have 2 or more octopi with the same answer for the number of legs.

If they are all lying then they either have a combination of 6 or 8 legs. Which means that there could only be 24, 26, 28, 30, or 32 legs. Looking at the answers, we can see that if they are all lying they would not mention 26 or 28 legs. Hence only one octopus is telling the truth.

This leaves one possibility: One octopus is telling the truth!

Now that we know that only one octopus is telling the truth. We find out which one! We start by assuming if one octopus is telling the truth or not and then prove or disprove that claim.

So lets say blue is telling the truth: so the blue one has either 6 or 8 legs. And each of the other octopus is lying hence has 7 legs. So our total legs becomes: 6 + 7 + 7 + 7 = 27 legs or 8 + 7 + 7 + 7 = 29 legs. But since blue says "28 legs", it contradicts the two possibilities of 27 and 29 legs hence he is lying.

Similarly for yellow and red, the leg combination possible would be 27 or 29, but they said 26 and 25. Hence they are lying.

The green octopus is the only one who gets the correct combination of legs hence he is telling the truth. The Green Octopus has 6 legs and the other three have 7 legs each.

-
But you had to assume a priori that only one octopus was telling the truth, which loses generality. Gotta show where you pulled that assumption out of :) –  smci Feb 19 at 11:52
@smci Thanks! Figured out that only one can be telling the truth. –  stackErr Feb 19 at 16:45

The green one is telling the truth. We know this because all of them gave different numbers which means that three out of the four servants are lying because only 1 total number of legs can be correct. So, since all 7 legged servants are liars, and we know 3 are lying, we multiply 7 * 3 and get 21. So 3 out of the 4 servants there have a total of 21 legs. The only options are 28(blue),27(green),26(yellow), and 25(red) so we know the red one is lying because the difference between 21 and 25 is 4 and there are no 4 legged servants. There are also no 5 legged servants so the yellow one is lying too. And the difference between 21 and 28 is 7, that would mean that they were all liars which isn't true. So Green is the only one left. The green is telling the truth and has 6 legs.

-
which means that three out of the four servants are lying At least three, not exactly three. –  starsplusplus Feb 17 at 11:53

I always like to write a little Python program to test my assumptions.

Here is what I came up with (pretty much follows exactly Songo's approach that he has written out in words):

from itertools import combinations_with_replacement

servants = {28: 'blue',
27: 'green',
26: 'yellow',
25: 'red'}

legs = {6: False,
7: True,
8: False}

number_of_servants = 4

for leg_combinations in combinations_with_replacement(legs.keys(), number_of_servants):
lying = [legs[leg] for leg in leg_combinations]
if lying.count(True) == 3 and sum(leg_combinations) in servants.keys():
print servants[sum(leg_combinations)]

-

The green one.

1. You can also solve the problem without assuming there is an honest servant among the four, because if all four were lying, there would be 28 legs, and the blue one couldn't be lying. – Steve Kass yesterday

• If all four were lying, then blue wouldn't be saying 28 because he'd be then saying the truth, which it isn't supposed to be because servants with 7 legs always lie.
2. To be even more picky, the servants didn't say if "altogether we" included the Octopus King or not, and if they did, how many legs the King had.

• The riddle said that four servants met. It didn't say that the four servants met with the king. But to answer your question, the King Octopus probably has 8 legs, given that it is an octopus. Unless, royalty grants an extra leg.
-

The green one is telling the truth. First of all if they all were lying, they would have 28 legs (7*4) and none of them would say "Altogether we have 28 legs", so at least one of them must be telling the truth. As each of them says something different, 3 of them must be lying and one is telling the truth. the 3 liars have 21 legs altogether (each of them must have 7 legs as it is a liar). Then we can rule out 25 or 26 legs (no octopuses have 4 or 5 legs). We can rule out 28 too, because this would mean that all of them have 7 legs, so the only possibility left to us is 27 legs -> green octopus.

-

Since at least 3 octopuses must be telling the lie, then it must be the green servant (with 6 legs) who is telling truth and 3 others (with 7 legs) are telling lies.

Other combinations listed here will not make sense (unless I missed out any).

blue = 28
8,8,6,6
7,7,7,7
8,7,7,6

green = 27
8,7,6,6
7,7,7,6 -> here it is!

yellow = 26
8,6,6,6
7,7,6,6

red = 25
7,6,6,6

-

## protected by Community♦Feb 20 at 11:20

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.