The Gateway to Computer Science Excellence
+1 vote
3.2k views
how many strings of 5 digits have the property that the sum of their digits is 7

a)66 b)330 c)495 d)99
in Others by (345 points) | 3.2k views

2 Answers

+5 votes
Best answer

Partition of 7 :
7,0,0,0,0
6,1,0,0,0
5,2,0,0,0
5,1,1,0,0
4,3,0,0,0
4,2,1,0,0
4,1,1,1,0
3,3,1,0,0
3,2,2,0,0
3,2,1,1,0
3,1,1,1,1
2,2,2,1,0
2,2,1,1,1

Arrangement of above Parition = 5!/4! + 5!/3! + 5!/3! + 5!/2!2! + 5!/3! + 5!/2! + 5!/3! + 5!/2!2! + 5!/2!2! + 5!/2! + 5!/4! + 5!/3! + 5!/3!2!
= 5 + 20 + 20 + 30 + 20 + 60 + 20 + 30 + 30 + 60 + 5 + 20 + 10 = 330


You can calculate alternatively :
(n+r-1)Cn : here n = 7, r = 5
Just Put values, answetr will be 330.

by Veteran (60.9k points)
selected by
+1
11C5 is not equal to 330
+7 votes

Here we are talking about $5$ digit strings (not numbers).

Required number of strings = Number of non-negative solutions of equation $x_{1}+x_{2}+x_{3}+x_{4}+x_{5} = 7$, where $x_{1},x_{2},x_{3},x_{4},x_{5} \geq 0$ and more that one digit can have same value.

Read this answer by @Debashish+Deka to understand how we get corresponding generating function.

So, the problem reduces to finding the coefficient of $x^7$ in $(1 + x + x^2 + x^3 + ....... +  \infty )^5$ = $\frac{1}{(1-x)^5}$

Coefficient of $x^7$ in $(1-x)^{-5}$ = $1 + \left(\begin{array}{c}5\\ 1\end{array}\right)x  + \left(\begin{array}{c}6\\ 2\end{array}\right)x^2 + \left(\begin{array}{c}7\\ 3\end{array}\right)x^3 + .......+ \left(\begin{array}{c}11\\ 7\end{array}\right)x^7 + .........+  \infty$

$=  \left(\begin{array}{c}11\\ 7\end{array}\right) =  \left(\begin{array}{c}11\\ 4\end{array}\right) = \frac{11*10*9*8}{4*3*2*1} = 330$
 

by Boss (28.8k points)
edited by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,388 answers
198,578 comments
105,416 users