Note that powers of 2 can be written in binary as
![2^0=1_2](https://tex.z-dn.net/?f=2%5E0%3D1_2)
![2^1=10_2](https://tex.z-dn.net/?f=2%5E1%3D10_2)
![2^2=100_2](https://tex.z-dn.net/?f=2%5E2%3D100_2)
and so on. Observe that
![n+1](https://tex.z-dn.net/?f=n%2B1)
digits are required to represent the
![n](https://tex.z-dn.net/?f=n)
-th power of 2 in binary.
Also observe that
![\log_2(2^n)=n\log_22=n](https://tex.z-dn.net/?f=%5Clog_2%282%5En%29%3Dn%5Clog_22%3Dn)
so we need only add 1 to the logarithm to find the number of binary digits needed to represent powers of 2. For any other number (non-power-of-2), we would need to round down the logarithm to the nearest integer, since for example,
![2_{10}=10_2\iff\log_2(2^1)=\log_22=1](https://tex.z-dn.net/?f=2_%7B10%7D%3D10_2%5Ciff%5Clog_2%282%5E1%29%3D%5Clog_22%3D1)
![3_{10}=11_2\iff\log_23=1+(\text{some number between 0 and 1})](https://tex.z-dn.net/?f=3_%7B10%7D%3D11_2%5Ciff%5Clog_23%3D1%2B%28%5Ctext%7Bsome%20number%20between%200%20and%201%7D%29)
![4_{10}=100_2\iff\log_24=2](https://tex.z-dn.net/?f=4_%7B10%7D%3D100_2%5Ciff%5Clog_24%3D2)
That is, both 2 and 3 require only two binary digits, so we don't care about the decimal part of
![\log_23](https://tex.z-dn.net/?f=%5Clog_23)
. We only need the integer part,
![\lfloor\log_23\rfloor](https://tex.z-dn.net/?f=%5Clfloor%5Clog_23%5Crfloor)
, then we add 1.
Now,
![2^9=512](https://tex.z-dn.net/?f=2%5E9%3D512%3C1024%3D2%5E%7B10%7D)
, and 999 falls between these consecutive powers of 2. That means
![\log_2999=9+\text{(some number between 0 and 1})](https://tex.z-dn.net/?f=%5Clog_2999%3D9%2B%5Ctext%7B%28some%20number%20between%200%20and%201%7D%29)
which means 999 requires
![\lfloor\log_2999\rfloor+1=9+1=10](https://tex.z-dn.net/?f=%5Clfloor%5Clog_2999%5Crfloor%2B1%3D9%2B1%3D10)
binary digits.
Your question seems to ask how many binary digits in total you need to represent all of the numbers 0-999. That would depend on how you encode numbers that requires less than 10 digits, like 1. Do you simply write
![1_2](https://tex.z-dn.net/?f=1_2)
? Or do you pad this number with 0s to get 10 digits, i.e.
![0000000001_2](https://tex.z-dn.net/?f=0000000001_2)
? In the latter case, the answer is obvious;
![1000\times10=10^4](https://tex.z-dn.net/?f=1000%5Ctimes10%3D10%5E4)
total binary digits are needed.
In the latter case, there's a bit more work involved, but really it's just a matter of finding how many number lie between successive powers of 2. For instance, 0 and 1 both require one digit, 2 and 3 require two, while 4-7 require three, while 8-15 require four, and so on.