• retagged by
5,193 views
17 17 votes
How many positive integers less than 1,000,000 have the sum of their digits equal to 19? (using generating function)

2 Answers

Best answer
28 28 votes
  • The number is $<$ $1000000$ , $\Rightarrow$ it contains 6 digits.
  • Each of these digits can be one of $0,1,2,3....9$

$\Rightarrow$ problem reduces to no of integral solution to the following equation

$d_1+d_2+d_3+d_4+d_5+d_6 = 19$ where $0\leq d_i \leq 9$

Using generating function : (how to use)

$$\begin{align*} & \ \ \ \left [ x^{19} \right ]\left ( 1+x+x^2+x^3+....+x^9 \right )^{6} \\ &=\left [ x^{19} \right ]\left [ \frac{1-x^{10}}{1-x} \right ]^{6}\\ &=\left [ x^{19} \right ]\left ( 1-x^{10} \right )^{6}. \sum_{r=0}^{\infty}\binom{5+r}{r}.x^{r} \\ &=\left [ x^{19} \right ]\left [ \sum_{r=0}^{6}.\binom{6}{r}.\left ( -x^{10} \right )^{r} \right ]. \left [ \sum_{r=0}^{\infty}\binom{5+r}{r}.x^{r} \right ] \\ &=\left ( -1 \right )^{0}*\binom{24}{19} + \left ( -1 \right )^{1}*6*\binom{14}{9} \\ &=30492\\ \end{align*}$$

NOTE:

1. $1+x+x^2+x^3+.....x^n = \frac{1-x^{n+1}}{1-x}$

2. $\frac{1}{(1-x)^n} = \sum_{r=0}^{\infty}\binom{n+r-1}{r}.x^r$

3. $\left [ x^{19} \right ]$ means coefficient of $x^{19}$ of the whole expression.

• edited by
2 2 votes
Without using generating functions.

From inclusion exclusion principle $Total \ objects = \ Total \ combinations\ - \ combinations \ with \ a\  digit > 9 \ =  C(24,19) \ -\ 6*C(14,9) $
• edited by
Position:
Show:

Related questions

2 2 votes
2 answers 2 answers
1.3k
1.3k views
dd asked Aug 29, 2016
1,281 views
Given a integer N greater than zero.How many sequences of 1's and 2's are there such that sum of the numbers in the sequence = N ?(not necessary that every sequence must ...
4 4 votes
2 2 answers
741
741 views
GO Classes asked Jun 11, 2025
741 views
How many $8-permutations$ are there of the $10$ $letters$ of the word $CALIFORNIA$ (with repeated letters)?A. $\frac{47}{4} \cdot 8$ !B. $\frac{47}{2} \cdot 8$ !C. $8!\cd...
1 1 vote
5 5 answers
694
694 views
0 0 votes
2 2 answers
436
436 views
GO Classes asked Jun 11, 2025
436 views
How many ways are there to form a $3-letter$ word (i.e. sequence) containing the letter $C$ using the letters $A, B, C, D, E$ with repetitions of letters allowed?