From, we have
Determine the number of positive integers $x$, where $x$ is less than equal to $9,999,999$ and the sum of the digits in x is $31$.
I got $512365$, with source of my programming solution at here.
I tried to do an analysis of my answer to see if it was probably correct. It was divisible by 7, which was a start. I then decided to try to estimate the number of solutions to the problem.
In general, we should get around 4.5 per digit, or a total of 31.5, which is quite close to the sum we are searching for, actually. Assuming that the sum of digits is normally distributed (my big question: is it?), we should get around 40%*9,999,999 , which is around 4 million, greatly disagreeing with my answer. What am I doing wrong?