I've been working through Sedgewick and Flajolet's Analytic Combinatorics and am stuck on a particular problem:
III.21. After Bhaskara Acharya (circa 1150AD). Consider all the numbers formed in decimal with digit 1 used once, with digit 2 used twice, $\dots$, with digit 9 used nine times. Such numbers all have 45 digits. Compute their sum $S$ and discover, much to your amazement, that $S$ equals 4587555960000615321908476928639999999999999999541244403999938467809152 30713600000. This number has a long run of nines. Is there a simple explanation?
I reasoned that, by grouping terms into groups of size 45 where there is one number with a 1 as the $k^{th}$ digit, two numbers with a 2 as the $k^{th}$ digit, etc. the expected value of the $k^{th}$ digit of $S$ is $(1^2 + 2^2 + \ldots + 9^2)/(1+2+\ldots+ 9 = \frac{285}{45}=\frac{19}{3})$. The number of terms in the sum is $\binom{45}{1,2,\ldots,9}$, so $S = \frac{19}{3}(1+10+\ldots+10^{45})\binom{45}{1,2,\ldots,9} = \frac{19}{3}(\frac{10^{46}-1}{9})\binom{45}{1,2,\ldots,9}$, which checks. But I have no idea where to go from here - the problem is in the chapter on multivariate generating functions, but I don't know how I could use those to find a particular string of 9's in the 10-ary expansion of a number.