Three Cat Owners and a Truth-or-Lie Rule: Find Bob's Count
Math & Bit ManipulationModel answerLast updated
Three friends speak under a rule that ties honesty to who owns more cats. Use the statements, parity, divisibility and a sum bound to find Bob's cat count and the triple of counts.
Three Friends, Three Cat Counts
Alice, Bob and Charlie own a, b and c cats. Each is a positive integer, and all three are different.
Honesty rule
When a person X addresses a person Y:
- If Y owns more cats than X, X is truthful and every claim in that statement is true.
- If Y owns fewer cats than X, X lies and every claim in that statement is false.
Conversation
- Alice to Bob: "You own more cats than Charlie, and Charlie's count is even."
- Bob to Charlie: "You own exactly 40% more cats than I do, and the average of our three counts is a whole number."
- Charlie to Alice: "Together we own more than 20 cats."
Task
- Use the honesty rule to work out which orderings of
a,bandcare possible. - Turn each statement into an arithmetic condition (inequality, parity, divisibility).
- Find Bob's cat count and the triple
(a, b, c)that the puzzle intends. - State whether the conditions, read strictly, really single out one triple. If not, say which extra assumption would.
Hints
Hint 1
Every statement has two parts: a comparison that decides truthful or lying, and content that must then be all true or all false. Branch on the comparison first, starting with whether Alice is truthful.
Hint 2
If Alice lies, both of her claims are false. With distinct counts, this tells you who has the fewest cats and whether `c` is odd or even. Then Bob is truthful, and 40% more means `5c = 7b`, so `b` is a multiple of 5.
Hint 3
Write `b = 5k` and `c = 7k`. Use the integer-average condition to get a divisibility fact about `a`, then check Charlie's sum claim in both orderings of `a` and `c`. Also test the branch where Alice is truthful instead of assuming it fails.
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Answer
The intended answer is Bob owns 5 cats, with (a, b, c) = (6, 5, 7). Read strictly, though, the puzzle also has other solutions. A strong answer finds the intended triple and says exactly which assumption makes it unique.
Setup
Whether a speaker is truthful depends only on one comparison between speaker and listener. Each statement therefore gives a comparison plus content constraints:
- Truthful: the listener has more cats and all claims hold.
- Lying: the listener has fewer cats and every claim is false, each one individually.
Because truthfulness comes from pairwise comparisons, branching on Alice's mode, then Charlie's, covers everything.
Case 1: Alice is truthful
Then b > a, b > c and c is even, so Bob has the most cats. Bob addresses Charlie, who owns fewer, so Bob lies. Both his claims are false:
c = 1.4bis false. This is automatic, sincec < b.- The average is not an integer, so
3 ∤ (a + b + c).
Charlie addresses Alice. If a > c he is truthful and the sum exceeds 20. If a < c he lies and the sum is at most 20.
This case is not contradictory:
(1, 4, 2): Alice is truthful (4 > 1, 4 > 2, 2 is even). Bob lies (2 is not 5.6, and the sum 7 is not divisible by 3). Charlie lies since 1 < 2, and the sum 7 is not above 20, so his claim is false as required.(9, 11, 2): the sum is 22, not divisible by 3. Charlie is truthful since 9 > 2, and 22 > 20.
So a strict reading admits solutions with Bob owning 4 or 11 cats. The intended solution quietly discards this branch.
Case 2: Alice lies
Both of Alice's claims are false:
- "
b > c" is false, sob < c(counts are distinct). - "
cis even" is false, socis odd.
Also a > b, because Alice lies to Bob. So Bob has the fewest cats.
Bob addresses Charlie, who owns more, so Bob is truthful:
c = 7b/5, so5 | b. Writeb = 5k,c = 7k. Sincecis odd,kis odd.- The sum
a + 12kis divisible by 3, so3 | a.
Now Charlie's statement, split on the order of a and c:
Sub-case b < a < c. Charlie addresses Alice, who owns fewer, so he lies and the sum is at most 20. Then a + 12k ≤ 20 with a > 5k gives 17k < 20, so k = 1. Hence b = 5, c = 7, and a must lie strictly between 5 and 7, so a = 6. Check: 6 + 5 + 7 = 18, divisible by 3.
Sub-case a > c. Charlie is truthful, so the sum must exceed 20. This has infinitely many solutions, for example (9, 5, 7), (12, 5, 7) and (24, 15, 21).
Verification of (6, 5, 7)
- Alice to Bob: Bob has fewer cats than... Alice has 6 and Bob has 5, so Alice lies. "5 > 7" is false and "7 is even" is false.
- Bob to Charlie: 7 > 5, so Bob is truthful. 7 = 1.4 x 5, and the average is 18/3 = 6.
- Charlie to Alice: 6 < 7, so Charlie lies. "18 > 20" is false.
What is actually forced
The only way to get a unique answer is to add an assumption. The cleanest is: Alice lies and Charlie also lies, which means the middle count belongs to Alice (b < a < c). Alternatively, take the smallest solution within the "Alice lies" branch. In an interview, state the fully rigorous result, then name the assumption and give (6, 5, 7).
Brute-force check
from itertools import permutations
def ok(speaker, listener, claims):
truthful = listener > speaker
return all(claims) if truthful else not any(claims)
def solutions(limit=30):
out = []
for a, b, c in permutations(range(1, limit + 1), 3):
s = a + b + c
if (ok(a, b, [b > c, c % 2 == 0]) and
ok(b, c, [5 * c == 7 * b, s % 3 == 0]) and
ok(c, a, [s > 20])):
out.append((a, b, c))
return out
sols = solutions()
print((6, 5, 7) in sols) # True
print([t for t in sols if t[1] < t[0] < t[2]]) # [(6, 5, 7)]
print(len(sols) > 1) # True: not unique
Complexity
By hand there are at most 3! = 6 orderings, each needing constant algebra. The brute force is O(N^3) time and O(1) extra space for counts up to N.
Common mistakes
- Assuming Alice must lie without checking the truthful branch.
- Reading a lie as "the conjunction is false". The problem says every claim is false, which is stronger.
- Forgetting integrality of
c = 1.4b, which is what forces5 | b. - Skipping Charlie's statement, which needs the order of
aandc. - Checking the "average is an integer" claim only when Bob is truthful. When he lies it must fail.
Follow-ups
- Ties allowed: if truthfulness is "listener has at least as many", you must consider weak orderings (13 instead of 6). The
(6, 5, 7)solution survives, but more solutions appear in the truthful-Alice branch. - General formulation: model it as a constraint problem. For each statement add
(Y > X) → all claimsand(Y < X) → no claim, plus distinctness. Enumerate orderings, or use an SMT solver. To test uniqueness, add a clause excluding the found solution and re-solve. If another solution appears, the puzzle is under-constrained, which is exactly what happens here.