Quoto

Learn / Library / Brainteasers

Quick measurements only

BrainteasersHard

A chemist has an empty -litre flask and an empty -litre flask, a tap and a sink. One operation is: fill a flask to the brim, empty a flask completely, or pour from one flask into the other until the source is empty or the target is full. An amount is measured when some flask holds exactly litres. For how many whole amounts from to can be measured using at most operations?

Checking an answer needs JavaScript. The hint and the solution open without it.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

Find the fewest operations for each amount separately, and count the ones that need or fewer.

Solution
  1. A breadth-first search from the empty pair gives the fewest operations for each amount from to .
  2. Amounts and need operation each, needs , needs and needs .
  3. The amounts , , , , and need , , , , and operations, which is more than .
  4. So exactly the amounts , , , and qualify, and the count is .

Answer: