CEMC Banner

Problem of the Week
Problem C and Solution
Sum Program

Problem

Ruben wrote a program that takes a list of numbers as input. The program then adds each pair of adjacent numbers in the list to obtain a new list of numbers, then repeats this process with the new list until the list contains only one number. This number is then the output.

For example, if the input is \((1,~5,~3,~2)\) then the program adds the adjacent numbers in the list to obtain \((6,~8,~5)\). The program then repeats this process to obtain \((14,~13)\), and then \((27)\). Since the list now contains only one number, the output is \(27\).

Let \(R\) represent Ruben’s favourite number. Ruben input the numbers \((6,~4,~R,~7)\) into his program and the output was \(4\) times his favourite number, or \(4R\). What is Ruben’s favourite number?

Solution

We could attempt this problem using trial and error, and perhaps we would even stumble on the correct answer. However, this may take a long time and is not an efficient method for solving the problem. Instead we will provide a more algebraic solution.

The list of numbers inputted into the program was \((6,~4,~R,~7)\). After the adjacent numbers are added together, we obtain \((10,~4+R,~R+7)\). After the adjacent numbers in this list are added together, we obtain \((10+4+R,~4+R+R+7)\), which is equal to \((14+R,~11+2R)\). After the adjacent numbers in this list are added together, we obtain \((14+R+11+2R)\) which is equal to \((25+3R)\). Since there is now one number in the list, this number should be equal to the output of the program, which is \(4R\). Thus, \[\begin{aligned} 25+3R &= 4R\\ 25+3R-3R &= 4R-3R\\ 25 &= R \end{aligned}\] Therefore, Ruben’s favourite number is \(25\).