Quoto

Learn / Library / Brainteasers

A counter with buttons

BrainteasersMedium

A counter shows . Each press of button A multiplies the shown number by , and each press of button B adds to it. What is the fewest number of presses that makes the counter show exactly ?

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

Work backwards from : when can the last press have been a multiplication?

Solution
  1. Backwards, a press of A divides by , which is possible only for a multiple of , and a press of B subtracts .
  2. From , subtract to , divide to and , subtract to and , and divide to and .
  3. The subtractions are forced, since , and are not multiples of , and dividing whenever possible keeps the route shortest.
  4. So the fewest number of presses is .

Answer: