How many numbers are between 1 and 99999 which have the sum of their digits equal to 9? I need the method.

2 Answers
Feb 10, 2018

#715#

Explanation:

#"Mathematically we are searching for a,b,c,d,e such that"#
#"a+b+c+d+e = 9. a,b,c,d,e are positive integers."#
#"This is a stars and bars problem. We have 9 stars (the sum"#
#"of the digits) and they must be divided in 5 groups."#
#"The number of combinations for that are C(9+4,4) = C(13,4),"#
#"with"#
#C(n, k) = (n!)/((n-k)! k!)#
#"So here we have"#
#C(13,4) = (13!)/((9!)(4!)) = 715#
#"possibilities."#

Feb 10, 2018

#715#

Explanation:

Suppose you have #5# boxes and #9# identical objects to distribute between them. How many ways can it be done?

Writing #""^n D_k# for the number of ways of distributing #n# identical objects between #k# boxes, we have:

  • #""^0 D_k = 1#

  • #""^1 D_k = k#

  • #""^n D_1 = 1#

  • #""^n D_2 = ""^n D_1 + ""^(n-1) D_1 + ... +""^0 D_1 = n+1#

  • #""^n D_3 = ""^n D_2 + ""^(n-1) D_2 + ... + ""^0 D_2#

    #= (n+1)+((n-1)+1) + ... + (1+1) + (0+1) = 1/2 (n+1)(n+2)#

  • #""^n D_4 = ""^n D_3 + ""^(n-1) D_3 + ... + ""^0 D_3#

    #= 1/2(n+1)(n+2) + 1/2((n-1)+1)((n-1)+2) + ... + 1/2(0+1)(0+2)#

#= 1/6(n+1)(n+2)(n+3)#

  • #""^n D_5 = ""^n D_4 + ""^(n-1) D_4 + ... + ""^0 D_4#

    #= 1/6(n+1)(n+2)(n+3)+1/6((n-1)+1)((n-1)+2)((n-1)+3)+...+1/6(0+1)(0+2)(0+3)#

#= 1/24(n+1)(n+2)(n+3)(n+4)#

So:

#""^9 D_5 = 1/24(9+1)(9+2)(9+3)(9+4) = 715#