Problem #PRU-79408

Problems Set theory and logic Theory of algotithms Theory of algorithms (other)

Problem

Peter bought an automatic machine at the store, which for 5 pence multiplies any number entered into it by 3, and for 2 pence adds 4 to any number. Peter wants, starting with a unit that can be entered free of charge to get the number 1981 on the machine number whilst spending the smallest amount of money. How much will the calculations cost him? What happens if he wants to get the number 1982?