Puzzle | The Remaining Numbers
Sahil and Amrit are friends. One day Amrit comes to Sahil’s home to take him outside so that they can play together. But Sahil denies saying that he will not play unless he reaches to the solution of the problem he is stucked with. So, Amrit decides to help him out .The problem is, given the first 50 natural numbers i.e., 1 , 2 , . . . . . . . 49 , 50 which are written on a board. Select two of the numbers on the board, say a and b , write the absolute value of their difference |a – b| on the board and then erase both a and b. Apply the above operation 49 times. Determine all possible values of the remaining number that can be obtained in this manner.
Solution : Any odd positive integer which is less than 50 can be obtained.
1) As initially the numbers from 1 to 50 are on the board, so the initial sum of numbers on the board is equal to
1 + 2 + 3 + 4 + ———- +50 = 1275, which is odd.
2) As in each operation select two numbers on the board i.e, a and b where a<=b, write the absolute value of their difference |a – b| on the board, and then erase both a and b.
= – a – b + |a – b|
3) As a<=b, therefore , |a – b| = -(a – b) = b – a ,which implies :
= – a – b + b – a = – 2a ————(1)
4) From result 1, this can concluded that each operation of replacing a and b by |a – b|, where a <= b without loss of generality, decreases the sum by 2a
5) From result 1 , it is clear that the new sum must be odd if the old sum was odd, and therefore no even number can result from repeated applications of such an operation starting with 1275.
6) Also given that all the numbers on the board are always nonnegative. They are also less than or equal to 50, since |a – b| is always less than or equal to the maximum of a and b for nonnegative a and b. Now , any odd integer from 1 to 49, inclusive, can be obtained by applying the puzzle’s operation 49 times.
7) Let k be such a number. This can be obtained in the first iteration by subtracting 1 from k + 1 as | 1 – (k + 1) | = k.
8) Then, apply the operation to the pairs of the remaining consecutive integers,
(2, 3), (4, 5), . . . , (k – 1, k), (k + 2, k + 3), . . . , (49, 50), to get 24 ones on the board while erasing the above pairs.
9) As till now, the operation is applied 25 times ( 1 in step 7 and 24 in step 8). Applying the operation 12 more times to the 24 pairs of ones yields 12 zeros, which can be reduced to a single zero after applying the operation 11 times.
10) After step 9, total number of times the operation is applied is 48. Finally, applying the operation to the two remaining numbers, k and 0, yields k.
As k is odd, hence any odd positive integer which is less than 50 can be obtained after applying the given operation for 49 times.
References : Algorithmic Puzzles – Anany Levitin, Maria Levitin