4. Alexei wrote several consecutive natural numbers on the board. It turned out that only two of the written numbers have a digit sum divisible by 8: the smallest and the largest. What is the maximum number of numbers that could have been written on the board?
Answer: 16.

Example: numbers from 9999991 to 10000007.

Evaluation. We will prove that there cannot be more than 16 numbers. Let's call a number $x$ good if the sum of its digits is divisible by 8. Among the listed numbers, there must be a number $x$ ending in 0, otherwise there are too few numbers. The number $x$ is not the first one, since then both $x$ and $x+8$ are good, and there are no more than 9 numbers. Among the numbers $x, x+1, \ldots, x+7$ there must be a good one - the largest with the specified property. The number $x-1$ ends in 9, so among the numbers $x-1, x-2, \ldots, x-8$ there must be a good one - the smallest with the specified property. Thus, all selected numbers fit into the interval from $x-8$ to $x+7$ inclusive. Therefore, the number of numbers written on the board does not exceed 16.

$\pm$ The evaluation is correct, the example has a minor error. 5-6 points

$\mp$ The evaluation without an example. 3 points

$\mp$ The example without an evaluation. 3 points