The number of 20 digits binary numbers with exactly k 1's in them is C(19,k-1) (where C(n,m) is binomial coefficient), since first digit of number is 1 and other k-1 one's are placed in 19 remaining positions.
So there are 1 number with exactly one digit 1;
C(19,2-1) = C(19,1) = 19 numbers with exactly two digits 1;
C(19,3-1) = C(19,2) = 19*18/(1*2) = 171 numbers with exactly three digits one;
and C(19,4-1) = C(19,3) = 19*18*17/(1*2*3) = 969 numbers with exactly four digits one.
The number of 20 digit binary numbers is 219, since first digit is always 1.
The number of 20 digit binary numbers with not fewer than four 1's is 219Â -1 -19-171 = 524097.
The number of 20 digit binary numbers with exactly 4 1's is 969.
Answer: There are 969 twenty digit binary numbers with exactly four 1's in them, and 524097 with at least four 1's in them.
////////
In case first digit of binary number can be 0, solution is
The number of 20 digits binary numbers with exactly k 1's in them is C(20,k) (where C(n,m) is binomial coefficient), since k one's are placed in 20 positions.
So there are 1 number with exactly zero digit 1;
C(20,1) = 20 numbers with exactly one digit 1;
C(20,2) = 20*19/(1*2) = 190 numbers with exactly two digits 1;
C(20,3) = 20*19*18/(1*2*3) =1140 numbers with exactly three digits 1;
C(20,4) = 20*19*18*17/(1*2*3*4) = 4845 number with exactly four digits 1.
The number of 20 digit binary numbers is 220.
The number of 20 digit binary numbers with not fewer than four 1's is 220-1-20-190-1140 = 1047225.
Answer: There are 4845 twenty digit binary numbers with exactly four 1's in them, and 1047225 with at least four 1's in them.
Comments
Leave a comment