Do more numbers from 1 to 10000 inclusive have an even or odd sum of their digits? I have tried using modulo arithmetic with $\bmod9$. However, I have found that it doesn't always help. It seems that for most numbers the parity of their digit sum is the same as the parity of the number $\bmod9$. But this is not always true. For example: $19 = 1\mod9$, but $1+9=10$ which is even. If someone could explain this as well, that would very helpful.
 A: Between $0$ and $9$ (inclusive), exactly half has even sum of digits, and exactly half has odd sum of digits. Same with $10$-$19$. Same with $20$-$29$. And so on. So for numbers from $0$ to $9\,999$ (inclusive) there are equally many numbers with even and odd sum of digits.
A: Picking a number from $0$ to $10^n-1$ means choosing $n$ digits, where leading zeroes are allowed. Leading zeroes do not affect the parity of the digit sum. There are as many ($5$) even digits as odd ones, so the amount of numbers with an even/odd digit sum is $5^n$ times the number of binary numbers of length $n$ with an even/odd digit sum, i.e. with an even/odd number of nonzero digits, which are the same, as there are as many subsets of $\{1,\ldots,n\}$ of even/odd size, see e.g. Alternating sum of binomial coefficients: given $n \in \mathbb N$, prove $\sum^n_{k=0}(-1)^k {n \choose k} = 0$.
Finally, we leave out $0$ and include $10^n$, so there are $2$ more numbers with an odd digit sum.
A: If n is even, then one of n and n+1 has an even sum of digits, and one has an odd sum. So if a range of numbers starts with an even and ends with an odd number, then there are equally many numbers with even and with odd digit sum. 
If the first number is odd, and/or the last number is even, then these need to be handled separately. In this case the first number 1 is odd and has odd digit sum, the last number 10,000 is even and has also odd digit sum, so there are two numbers more with odd than with even digit sum from 1 to 10,000. 
This can be applied easily to any other range, for example the numbers from 1234 to 5678: The first one is even (ignore it), the last one is even and 5678 has even digit sum, so there is one number more with an even sum of digits.
