.
.
Look at the coefficients of the 2s.
An example in base 10 might help:
$\displaystyle 571 = 5 \cdot 10^2 + 7 \cdot 10^1 + 1 \cdot 10^0$
Similarly:
$\displaystyle 571 = 1 \cdot 2^9 + 0 \cdot 2^8 + 0 \cdot 2^7 + 0 \cdot 2^6 + 1 \cdot 2^5 + 1 \cdot 2^4 + 1 \cdot 2^3 + 0 \cdot 2^2 + 1 \cdot 2^1 + 1 \cdot 2^0 \implies 1000111011 $
Does this help?
-Dan
yes, that does help, i've never seen this method before. thanks
it kind of seems clumsy though. how would you know how to represent 571 as a combination of different powers of 2's quickly and easily. do you start with the highest power of 2 you can get without exceeding the number, and then just stumble your way through the lower powers?
EDIT: wait, i think i got it, lemme check
EDIT 2: yeah, i got it, it wasn't as tedious as i thought it would be. that's nice!
Note that we end up with a 10-bit string.
We have a 1 in each place where that is a power of two.
See that there is $\displaystyle 2^9$ but none of $\displaystyle 2^8 \; 2^7 \; 2^6$ but there is a $\displaystyle 2^5$.
Thus we see 10001… . That is, there is a 1 where there is a power of two.
From right to left, there are ones in the first two positions but a zero in the third position because there is no $\displaystyle 2^2$.
i was taught the method where you repeatedly divide the number by two. in doing so, you will always get a remainder of 0 or 1. the trick is to keep track of these remainders, at the end, the remainders give you the number in binary when you read them in reversed order.
that method (as well as your method) is shown here
look at the "Short division by 2 with remainder" section for the method i described