One quart in each of a 7 and a 5 quart jug
Question
A barrel holds quarts of beer. Anna may keep some only if she ends up with exactly one quart in a -quart jug and exactly one quart in a -quart jug (she has one of each). She may pour between the barrel and the jugs in either direction, pour between jugs, and pour liquid away. Each such pour counts as one transaction. What is the fewest transactions that achieve this? Enter if it cannot be done.
Short answer
17. A breadth-first search over (barrel, 7-jug, 5-jug) states with these moves confirms the minimum is . The trick is to use the barrel itself as a measure: fill both jugs, pour away the remaining quarts, then shuttle beer between the jugs and barrel until a single quart can be isolated in each jug.
Adapted from QuantQuestions.io; question and answer rewritten by SelfMadeQuant.com.
See the hint and the full worked solution in the question bank (free account).
Open the worked solution