Monday, 4 May 2015

combinatorics - Sequence where the sum of digits of all numbers is 7



BdMO 2014





We define a sequence starting with $a_1=7,a_2=16,\ldots,\,$ such that the sum of digits of all numbers of the sequence is $7$ and if $m>n$,then $a_m>a_n$ i.e. all such numbers are arranged in ascending order. If $a_k=2014$, find $a_{\frac{k}{2}+3}$.




Let us call the numbers of the sequence 'good'.Then there are 1 one-digit good number,7 two-digit good numbers, 28 three-digit good numbers,and (28 four digit good numbers that start with 1). Total$=64$. Then 2014 is the 66th number.Therefore we want $a_{36}$. We note that there are 36 good numbers from 1 to 999. So the 36th good number is the largest 3 digit good number, i.e. 700.



Is there a better way?The above method clearly is a practical way of doing it,but is there a smarter way?


Answer



OK. I could just come up with a better way of enumerating the number of terms in the sequence. Maybe, you too used the same method.



To find the number of terms having less than 4 digits, consider $x_1x_2x_3$ with the condition that $x_1 + x_2 + x_3 = 7$ and $x_1 \geq 0, x_2 \geq 0, x_3 \geq 0$. This is a standard combinatorics problem with number of solutions $= \binom{9}{7} = 36$




Next, we need to find the number of 4-digit terms with the first digit equal to $1$. So, consider $1x_1x_2x_3$ with $x_1 + x_2 + x_3 = 6$ and a similar analysis gives the number of solutions $= \binom{8}{6} = 28$.



Then $2005$ happens to be the $36 + 28 + 1 = 65$th term and hence $2014$ is the $66$th. The rest is same as explained by @rah4927.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...