Of the first $2020$ natural numbers, how many have exactly three digits of $1$ when written in base $2$ form?

60 Views Asked by At

Title is the question. This is from a timed competition

My strategy: 2020 in base 2 is 11111100100. Then, you can find the answer by $10 \cdot 9 + 9 \cdot 8 + 7...$. This gets me the answer 330, but it's not correct

1

There are 1 best solutions below

6
On BEST ANSWER

Because $2020$ is larger than $11100000000=1792$ in binary, any $3$ $1$s will suffice. There are $11$ digits, and you want only $3$ of them to be $1$s, and the rest are $0$s. Therefore, you can just do $_{11}C_3=165$.