Water Calculator (water)

177 teams scored 4280 points on this task, for a maximum score of 70, an average score of 24 and a median score of 40.

Highlights

  1. Filippo Lussana, Bergamo is the institute with the most points (240).
  2. Lombardia is the region with the most points (725).

Statement

William has recently built a Water Calculator^, which mimics the operation of a computer through water pipes, sinks and siphons. Due to the rudimentary nature of its circuits, the Water Calculator^ is able to store a single number up to a billion and perform only a handful of atomic operations: (1) add or subtract 1; (2) multiply by 2; (3) divide by a power of 3 (which divides exactly the stored number). These few operations are anyway more than sufficient for William's basic mathematical needs. In this moment, the Water Calculator^ is holding number N. Since William needs to leave his home for a while, it is crucial to empty the calculator in order to avoid malicious rusting! Calculate the minimum number of atomic operations necessary for William to completely empty the calculator.