How many natural numbers have a digit sum equal to 20?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
To do this problem, I would use a technique known as generating function
Let digits be d 1 , d 2 , d 3 , d 4 , d 5 , d 6
and d 1 + d 2 + d 3 + d 4 + d 5 + d 6 = 2 0 and 0 ≤ d i ≤ 9 .
Now, we will generate a function -
f ( x ) = ( 1 + x + x 2 + x 3 + x 4 + x 5 + . . . . . x 8 + x 9 ) 6
And the coefficient of x 2 0 in f ( x ) is our answer.
f ( x ) = 1 − x 6 ( 1 − x 1 0 ) 6
( 1 − x ) − n = 1 + ( n + 1 − 1 1 ) ∗ x + ( n + 2 − 1 2 ) ∗ x 2 + . . . . . ( n + r − 1 r ) ∗ x r . . .
Hence,
f ( x ) = ( ( 1 − x 1 0 ) 6 ) ∗ ( 1 + ( 6 + 1 − 1 1 ) ∗ x + ( 6 + 2 − 1 2 ) ∗ x 2 + . . . . . ( 6 + r − 1 r ) ∗ x r . . . )
This is simple binomial expansion - ( 1 − x 1 0 ) 6
And so, the coefficient of x 2 0 is the sum of coefficients of
( x 2 0 in 1st part of product) * ( x 0 in 2nd part of product)
( x 0 in 1st part of product) * ( x 2 0 in 2nd part of product)
( x 1 0 in 1st part of product) * ( x 1 0 in 2nd part of product)
Hence,
coefficient of x 2 0 in the product = ( 6 2 ) − ( 6 + 1 0 − 1 1 0 ) ( 6 1 ) + ( 6 + 2 0 − 1 2 0 )
= ( 6 2 ) − ( 6 + 1 0 − 1 1 0 ) ( 6 1 ) + ( 6 + 2 0 − 1 2 0 )
= 3 5 1 2 7