Problem 2. On the board, there are 2017 digits. From these, several numbers were formed, the sums of the digits of these numbers were calculated, and then the sum of all the numbers was subtracted by the sum of the sums of their digits. The resulting number was broken down into digits, and the above operation was repeated again. After performing this operation several times, only one digit remained on the board for the first time. What is this digit?
Solution. Since the difference between a number and the sum of its digits is divisible by 9, the first operation will result in a number that is a multiple of 9. Moreover, if we take the sum of several numbers and subtract the sum of the digits of these numbers, the result will also be a multiple of 9. Continuing the calculations, we will get numbers that are multiples of 9 but decreasing in absolute value. In the end, the first single-digit number we obtain must be divisible by 9, and that is only 9.