Two pints from 7 and 11 pint jugs
Question
You need exactly pints of water from a stream, but only have an unmarked -pint jug and an unmarked -pint jug. A move is filling a jug, emptying a jug, or pouring from one jug into the other. What is the smallest number of moves that leaves exactly pints in one jug?
Short answer
14. Repeatedly fill the -pint jug and tip it into the , emptying the whenever full; the amounts left behind go (adding modulo ). A breadth-first search over jug states confirms that moves is the minimum.
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