# King Octopus and His Servants

King Octopus has servants with 6, 7, or 8 legs. The servants with 7 legs always lie, and the servants with 6 or 8 legs always tell the truth. One day four of the king’s servants had the following conversation:

“We together have 28 legs,” said the first octopus.

“We together have 27 legs,” said the second octopus.

“We together have 26 legs,” said the third octopus.

“We together have 25

Which of the four servants told the truth?

**SOLUTION**

If all four octopuses lied, then their total number of legs must be 28, which is impossible. Therefore exactly one of them said the truth, and the other three had 7 legs each. Since the truthful octopus must have 6 or 8 legs, and 21 + 8 = 29, we see that it has exactly 6 legs, and therefore it is the second one.

We do not know where this puzzle originated from. If you have any information, please let us know via **email**.

I don’t quite understand. The second solution is said to be correct because it consists of 3 lying octopuses and 1 truthful 6 legged. Maybe I’m missing a rule, but by that logic I could easily make every answer correct. For 28, 6+6=12 8+8=16 12+16=28 proving the first a guaranteed possibility as it cannot consist of 4 liars or else they would not say 28. The second is already proven but consists of 3 liars which is a confusing probability to incorporate into the problem. 26 can be solved by 6+8+6+6=26. 25 can be solved with 6+7+6+6=25. As you can see, two of the possibilities can be made without having any liars at all, so you would think that 1 and 3 would be the most plausible. It would actually be the most unlikely for solution B to be correct. If I am missing something please inform me, for now this seems broken to me.

Hello Boi. You cannot have more than one octopus which say the truth, because they would contradict each other.

# a simple ‘scip’ model for solving this puzzle

set s1to4 := { 1..4 };

var l[s1to4] integer >=6 =0 <= 32; # total number of legs

subto t0: sum

~~in s1to4: l[s] == tl;~~~~var x[s1to4] binary; # is this octopus telling the truth?~~subto t1:forall

~~in s1to4 do vif l[s]==6 then x[s]==1 end;~~subto t2:forall

~~in s1to4 do vif l[s]==7 then x[s]==0 end;~~subto t3:forall

~~in s1to4 do vif l[s]==8 then x[s]==1 end;~~~~subto s1: vif x[1]==1 then tl==28 else abs(tl-28)>=1 end;~~subto s2: vif x[2]==1 then tl==27 else abs(tl-27)>=1 end;

subto s3: vif x[3]==1 then tl==26 else abs(tl-26)>=1 end;

subto s4: vif x[4]==1 then tl==25 else abs(tl-25)>=1 end;

( My previous comment got truncated )

A scip model for solving this puzzle can be found at

https://gist.github.com/saska-gist/ce59c441d166aaae4a88cb56fa525b1b