In: Computer Science
Suppose you are converting 273332 (base 10) to base 2 using the subtraction method. What is the decimal number you have left for conversion after 3 steps?
I have to convert 273332 (base10) to base 2 using the subtraction method.
Find the largest power of 2 that is less than 273332.
So let’s go through the powers of 2:
1, 2, 4, 8, 16, 32, 64........... 262144(2^18), 524288(2^19).
Step 1- Okay, 524288 is larger than 273332 so we take one step back and get 262144. 262144 is the largest power of 2 that is still smaller than 273332. How many “whole” (not partial or fractional) times can 262144 go into 273332?
It can go in only once because of 2 x 262144 = 524288 which is larger than 273332. So, we write down a 1.
1
Now, we subtract 262144 from 273332: 273332 – (1)(262144) = 11188.
Step 2- And we move to the next lower power of 2. In this case, that would be 131072. How many full times can 131072 go into 11188? Once. So we write down another 0 and repeat the process.
10
Now, we subtract 11188-(0)(131072) =11188.
Step 3- And we move to the next lower power of 2. In this case, that would be 65536. How many full times can 65536 go into 11188? Once. So we write down another 0 and repeat the process.
100
Now, we subtract 11188-(0)(65536) =11188.
Step 4- And we move to the next lower power of 2. In this case, that would be 32768. How many full times can 32768 go into 11188? Once. So we write down another 0 and repeat the process.
1000
Now, we subtract 11188-(0)(32768) =11188.
Step 5- .....
Step 6- ........
.
.
.
.
The decimal number you have left for conversion after 3 steps is 11188.