retagged by
1,717 views
6 votes
6 votes

Consider the (decimal) number $182$, whose binary representation is $10110110$. How many positive integers are there in the following set?$$\{n\in \mathbb{N}: n\leq 182 \text{ and n has } \textit{exactly four} \text{ ones in its binary representation}\}$$

  1. $91$
  2. $70$
  3. $54$
  4. $35$
  5. $27$
retagged by

1 Answer

7 votes
7 votes
Total Bits = 8

case 1 : Starts with 0, then it must be less than 182

So, in the remaining 7 Bits, you need to choose 4 bits as 1 ==> $\binom{7}{4}$ = 35

 

case 2 : Starts with 1, then next bit should be 0 for total decimal value ≤ 182.

So, in the remaining 6 Bits, you need to choose 3 bits as 1 ==> $\binom{6}{3}$ = 20

but in this 20 patterns, $1011\color{red}{1}000$ is grater than given number. SO only 19 patterns are matching with our condition.

 

Total = 35+19 = 54
Answer:

Related questions

3 votes
3 votes
1 answer
1