Difficulty: Easy · Puzzle 4 of 6 · Topic: Classic Brain Teasers
You have unmarked 3-liter and 5-liter jugs plus unlimited water. Measure exactly 4 liters.
Create a 2-liter remainder first, then use it as an offset.
1) Fill 5L jug and pour into 3L jug => 5L now has 2L left.
2) Empty 3L jug.
3) Pour the 2L from 5L into 3L jug.
4) Fill 5L jug again.
5) Pour from 5L into 3L until 3L is full; it needs 1L to go from 2L to 3L.
6) So 5L jug is left with exactly 4L.Answer: Sequence leaves 4 liters in the 5L jug after creating 2L in the 3L jug and topping it up.
Checked by running a model of the rule in a Python model. A computational check: breadth-first search over all (3 L, 5 L) jug states finds 4 L needs 6 steps, the stated sequence is legal, and the reachable amounts match the gcd rule (3 and 5 reach 0 to 5, 4 and 6 only even amounts).
Trying to make 4 L in one move. Only differences of the jug sizes (5-3 = 2) are available, so build the 2 L remainder first and then top up the 3 L jug by 1 L.
Can you derive a general solvability rule for jug sizes a and b? Model answer: a target t is reachable iff t <= max(a,b) and t is a multiple of gcd(a,b) (Bezout: you can only change contents by +-a and +-b). For 3 and 5, gcd = 1 so every amount 1 to 5 is reachable; for 4 and 6 only even amounts are.
I can only change the amounts by the jug sizes, so I build up from the difference five minus three, which is two. I fill the five-litre jug and pour into the three, leaving two litres in the five. I empty the three and pour the two litres across, then fill the five again. Now I pour from the five into the three until it is full, and that takes just one litre, since the three already holds two. The five-litre jug is left with exactly four litres; the trap is trying to get four in a single move.