Pick 10 numbers between 1 and 255 convert each of them into their binary equivalent.

Expert Answers
Borys Shumyatskiy eNotes educator| Certified Educator

Hello!

Let's make a list of decimal numbers: 4, 5, 10, 15, 49, 71, 100, 111, 189, 255.

And convert them into their binary representation. A hope you know that binary number system is a positional one and has only two digits, 0 and 1. Each next (to the left) one "costs" twice as the previous digit.

So 1_dec=1_bin but 2_dec=10_bin, 3_dec=11_bin and so on.

There are at least two ways to convert decimal to binary. The first starts from the least significant digit and moves to the left, the second is vice versa. In the first method we consecutively divide by 2 and watch for the remainder, In the second consecutively determine the most degree of 2 which is not greater than our number.

 

Use the first method for the first five numbers.

1. 4 is divisible by 2, so it has 0 at the end (no ones), the quotient is 2. 2 is also divisible by 2, so 0 again, the quotient is 1. And 1 isn't divisible by 2, so 1.
The answer is `100_(bi n).`

2. 5 isn't divisible by 2, so the remainder is 1 and the quotient is 2. 2 gives the remainder 0 and the quotient 1, 1 is 1. So the answer is `101_(bi n).`

3. 10: 0, 1, 0, 1, i.e. `1010_(bi n).`

4. 15: 1, 1, 1, 1, i.e. `1111_(bi n).`

5. 49: 1, 0, 0, 0, 1, 1, i.e. `110001_(bi n).`

 

Use the second method for the second five numbers.

6. 71: `2^7=128gt71gt=64=2^6,` so 1 at the 7-th position (for `2^6`). 71-64=7, so zeros for 32, for 16 and for 8. Then 1 for 4, 7-4=3, so 1 and 1.
So the answer is `1000111_(bi n).`

7. 100: 1 for 64, 100-64=36. 1 for 32, 36-32=4. 0 for 16, 0 for 8, 1 for 4, 4-4=0 so 0 for 2 and 0 for 1.
The answer is `1100100_(bi n).`

8. 111: 1, 1, 0, 1, 1, 1, 1. The answer is `1101111_(bi n).`

9. 189: 1, 0, 1, 1, 1, 1, 0, 1. The answer is `10111101_(bi n).`

10. 255 is `11111111_(bi n)` (try it yourself :) ).

 

 

 

 

 

 

 

erozmiarek eNotes educator| Certified Educator

Another way to convert decimal numbers (base 10) into binary numbers (base 2) is to become familiar with the powers of two and the values of the place columns in each system. 

In base 10, most everyone is familiar with the values of the columns:  beginning at the far right, at the decimal point, and moving to the left (toward higher values), the columns are the "ones," "tens," "hundreds," "thousands," "ten-thousands," and so on, with each column having a value ten times the one before it. 

In base 2, the system is the same, but each column is worth only 2 times the column before it.  So, starting from the smallest, we have the "ones," "twos," "fours," "eights," "sixteens," "thirty-seconds," and so on, doubling in value each time.  You should be able to see that a number in base 2 will be longer than the same value in base 10.

To write a number in base 2 (binary), start with the highest value place column that is lower than the number itself, and mark a 1.  Then move down to the lowest column, deciding whether that value can be added.

Example:  Convert 37 from base 10 to base 2.

First, look at the columns:

64's.... 32's.... 16's.... 8's.... 4's.... 2's.... 1's

Because our number is 37, we will start by marking a 1 in the "32's" column.  Subtract 32 from the original number of 37, to leave a remainder of 5.

Next, because this is less than the next column, 16's, mark a 0 in the 16's column.

Similarly, mark a 0 in the 8's column.

Next, because 4 is less than 5, mark a 1 in the 4's place, subtract 4 from the value of 5, and you have 1 left.

Because this is less than 2, you mark a 0 in the 2's column.

Finally mark a 1 in the 1's column.

Your final number will look like this:  100101

To check, add up the values:  you have (1x32) + (0x16) + (0x8) + (1x4) + (0x2) + (1x1) = 32+4+1 = 37.

This seems a little long, but after you get used to the place columns as powers of 2, it moves quickly.

Another example:  71 = 64 + 4 + 2 + 1 = 1000111