$[$ Modular arithmetic (other) $]$ [ Decimal number system ]

How many integers from 1 to 2001 have a sum of digits that is divisible by 5?
Prove that in every complete decade there are two numbers with a sum of digits divisible by 5.

## Solution

We will divide all numbers from 1 to 2001 into decades: two incomplete ones, the first of which includes numbers from 1 to 9, and the second includes numbers 2000 and 2001, and 199 complete decades - from 10 to 19, from 20 to 29, ..., from 1990 to 1999. In the incomplete decades, there is only one number with a sum of digits divisible by 5 (this can be verified directly).

In a complete decade, the sum of the digits of each subsequent number modulo 5 is obtained by adding one to the sum of the digits of the previous number. Therefore, in each such decade, there are exactly two numbers with a sum of digits divisible by 5.

Thus, the number of such numbers is \(1 + 2 \cdot 199 = 399\).

## Answer

399.