How to compute the probability of sum of $5$ digits number to be equal to $23$? For example, $26843$ makes $2+6+8+4+3 = 23$.
Let's say I want to encode my book with number $23$ as my pattern that shows the intactness of my book in any new print. I also do not declare this but let's say I also mentioned the number $23$ out of context in my book for curious readers. If someone realize years later that the sum of the digits of the number of all the letters in my book is equal to $23$.
How likely s/he can think of this can occur by chance?
What is the general way of calculating this for any other number?
 A: So using the stars and bars method, I usually use $1$s and $0$s. So your case above we can express it as:
$$110111111011111111011110111=23$$
So we can use combinatorics by: ${23+4 \choose 4}=17550$
Edit just to clarify: The ones and zeros do not matter you can use any symbol you would like, it basically means if you can list one scenario with ones/zeros like the one above because $2$ is two ones, then use a zero to separate it, then next you had $6$ so I used six ones and separated by another zero etc etc! Hope you can see where I got the pattern from. Then we do: $${\text{number of ones and zeros} \choose \text{number of zeros}}$$
which is a combinatoric, for which there is an easy formula for it (google it).
For another example we have $9+9+1+1+3=23$, so this pattern would be:
$$111111111011111111101010111=23$$
Again we have number of ones is $23$, number of zeroes is $4$ so the answer is the same before. Not too mathsy but if you think about it all patterns are made up this way by changing the positions of ones and zeroes try it yourself! So there are $17550$ different number like this!
Hope this helps!
A: Your question can be reduced to the well-known problem of spreading $n$ balls in $m$ bins provided that the capacity of a bin is $p$ balls. The number of ways to do this is:
$$N (n,m,p)=\sum_{i\ge0}(-1)^i\binom mi \binom{n-i (p+1)+m-1}{m-1}.$$
With this at hand the answer to the question is
$$\frac {N (23,5,9)-N (23,4,9)}{90000}=\frac {6000-480}{90000}=\frac {23}{375}.
$$
The term $N(23,4,9)$ here counts the "5-digit" numbers which starts with $0$ (such as $06485$), $90000$ is the overall number of 5-digit numbers.
