We start at the left and ask whether it is larger or equal to that bucket. 13 is not >= than 16, so our first binary digit from left to right is '0'. 13 is greater than 8, so we divide our number by that bucket without going over (8), and we get our next binary digit '1'. If you ever manage to put anything other than 0 as a digit, you then take the remainder of the division. (13-8=5). So now our running total is 5. Because 5 is greater than 4, we divide it, and get our next binary digit '1'. Then we subtract it from our running total to get a running total of '1'. 1 is not greater than 2 so we go to the next digit. 1 is greater than or equal to 1, so we now have our last binary digit '1'. You should always end with a running total of 0. Now if we put the binary digits in a row we have '01101'. 13 in decimal is equal to 01101 in binary.
Bookmarks