CEMC Banner

Problem of the Week
Problem D and Solution
Machine Math

Problem

A positive integer \(p\) is input into a machine. If \(p\) is odd, the machine outputs the integer \(p + 5\). If \(p\) is even, the machine outputs the integer \(p + 11\). This process can be repeated using each successive output as the next input. For example, if the input is \(p = 1\) and the machine is used three times, the final output is \(22\).

If the input is \(p = 2023\) and the machine is used \(101\) times, find the final output.

Solution

If \(p\) is odd, the output is \(p+5\), which is even because it is the sum of two odd integers. If \(p\) is even, the output is \(p+11\), which is odd, because it is the sum of an even integer and an odd integer.

Starting with \(p = 2023\) and using the machine \(2\) times, we obtain \(2023+5 = 2028\) and then \(2028 + 11 = 2039\).

Starting with \(2039\) and using the machine \(2\) times, we obtain \(2039 + 5 = 2044\) and then \(2044 + 11 = 2055\).

Starting with an odd integer and using the machine \(2\) times, the net result is always adding \(16\) to the input, because the odd input generates a first output that is \(5\) larger (and so even) and a second output that is \(11\) larger than the first output. This generates a net result that is \(5 + 11= 16\) larger than the input.

Therefore, using the machine \(96\) more times (that is, repeating the \(2\) steps a total of \(48\) more times) we add \(16\) a total of \(48\) more times to obtain the output \(2055 + 48 \times 16 = 2823\). To this point, the machine has been used \(100\) times.

The next time the machine is used, the output is \(2823 + 5 = 2828\).

Thus, the final output after the machine is used \(101\) times is \(2828\).