B2. How many natural numbers less than 100000 have a sum of digits divisible by 9 or 5?
B2. Natural numbers whose sum of digits is divisible by 9 are exactly those divisible by 9. Therefore, there are $\frac{99999}{9}=11111$ such numbers less than 100000. Every natural number less than 100000 is of the form $\overline{a b c d e}$, where at least one of the digits $a, b, c, d$, and $e$ is different from 0. If we fix the last four digits and denote their sum by $\mathrm{s} k$, then we must choose $a$ such that $k+a$ is divisible by 5. Regardless of what $k$ is, we have exactly 2 options for $a$; $a=0,5$ if $k$ is divisible by 5, $a=4,9$ if $k$ has a remainder of 1 when divided by 5, $a=3,8$ if $k$ has a remainder of 2 when divided by 5, $a=2,7$ if $k$ has a remainder of 3 when divided by 5, and $a=1,6$ if $k$ has a remainder of 4 when divided by 5. Therefore, the last four digits can be chosen arbitrarily, and for the first digit, we have two options. Thus, there are $10^{4} \cdot 2-1=19$ 999 such numbers, as we have also counted the number $0=\overline{00000}$. We must also count the numbers whose sum of digits is divisible by $\mathrm{s} 5$ and 9, i.e., by 45. However, the sum of the digits of a number less than 100000 is at most $5 \cdot 9=45$ and this only happens when all digits are 9. Such a number is therefore only one, i.e., 99 999. The numbers we are asked for in the problem are therefore $11111+19999-1=31109$.
Correctly counted the numbers whose sum of digits is divisible $\mathbf{z} 9$ ..... 1 point
Observation that for divisibility by 5, it suffices to observe only one digit ..... 1 point
All possible options for the observed digit written down ..... 1 point
Correctly counted the numbers whose sum of digits is divisible $\mathbf{s} 5$ ..... 1 point
Correctly counted the numbers whose sum of digits is divisible $\mathbf{s} 45$ ..... 1 point
Answer ..... 1 point