For example, how do you convert 121 base 10 into binary (base 2)?
Please show me the exact workings or any websites that show that. Any help will be greatly appriciated.
Thanks
2006-11-23
18:24:37
·
7 answers
·
asked by
MATH!!!!
2
in
Science & Mathematics
➔ Mathematics
PS: Please respond with workings or websites with workings. I do have many websites that can do conversion, but I would like to know how it is done.
2006-11-23
18:34:58 ·
update #1
You can do this by hand.
Call your number x.
Write the binary digits of x as b_i :
x = sum_n=0_n=N b_n.2^n
The algorithm is simple: compare your number x to the largest power of two (2^N), subtract if necessary, and decrease n until finished (n=0).
Start with n=N , the largest integer such that X >=2^n
If x >= 2^n, then {
b_n = 1;
x = x-2^n;
n = n-1;
} else {
b_n 0;
}
The above is pseudocode, you could do it in C, PERL, Python, Java etc.
So: x= 121 = 64+57=(64+32)+25=(64+32+16)+9
=(64+32+16+8)+1 =64+32+16+8+0+0+1
Thus 121 (base 10) = 1111001 (base 2)
2006-11-23 18:28:16
·
answer #1
·
answered by smci 7
·
1⤊
2⤋
The easiest thing to do is to
1. find the largest power of 2 that goes into 121, it's 64=2^6, so you know that you have a 1 in the 2^6 position in your binary number
continue dividing and work with remainders:
121/64 = 1 r 57 2^6 or 64
57/32 = 1 r 25 2^6 or 32
25/16 = 1 r 9 2^4 or 15
9/8 = 1 r 1 2^3 or 8
1/4 = 0 r 1 2^2 or 4
1/2 = 0 r 1 2^1 or 2
1/1 = 1 r 0 2^0 or units...
put it together:
121 = 0111 1001,
2006-11-23 18:41:21
·
answer #2
·
answered by modulo_function 7
·
0⤊
1⤋
There are two ways of doing this, and the main one hasn't even been mentioned yet, I don't think.
First way (good for small numbers, useless in general): keep finding the biggest power of 2 thats smaller than what you have, and subtract it. Etc. So you get 64 (57 left), 32 (25 left), 16 (9 left), 8 (1 left), 1. So you have 1111001, since you skipped out the 4 and 2.
But that way doesn't really work very well in general.
An easier way:
Keep dividing by 2. Write down all the remainders in reverse order.
So:
121 / 2 = 60 R 1
60 / 2 = 30 R 0
30 / 2 = 15 R 0
15 / 2 = 7 R 1
7 / 2 = 3 R 1
3 / 2 = 1 R 1
1 / 2 = 0 R 1
The remainders in reverse order are 1111001.
That works for *any* base as well, not just base 2.
2006-11-23 18:53:02
·
answer #3
·
answered by stephen m 4
·
1⤊
2⤋
for your understanding here is a comparison
decimal binary
1 1
2 10
3 11
4 100
so, any decimal number is expressed as power of 2 in binary and if the power of 2 is non zero, we get one 1 else we get 0. Then we have to give digit (either 0 or 1) until power of 2 become 0. We have to see maximum power of 2 and the number of digits will be 1 digit more, here is the example.
4 = 2^2 +0+0 = we get 1 for 2^2 and since the power of 2 is 2 we will get 2 more digits. since 2^2 =4, thus the required binary no. will be 100.
5=2^2+0+2^0 and thus 5 in binary system it will be 101
Thus to express 121 in binary system, you need to find out how many power of 2 can go maximum and then express it by addition of power of twos like below
121 = 64 (2^6) + 32 (2^5) + 16 (2^4) + 8 (2^3) + 0+0+1 (2^0)
so we will have a 7 (6+1) digit no as like this
1111001 (the two zeros are coming due to no present of power of 2)
hope this helps
cheers :)
2006-11-23 18:52:21
·
answer #4
·
answered by TJ 5
·
2⤊
0⤋
find the largest exponential value of 2 in the number (64)
subtract it
repeat
then write what you have in zeros and ones backwards
1111001
2^6 + 2^5 + 2^4 + 2^3 + (0*2^2) + (0*2^1) + 2^0
64+32+16+8+0+0+1=121
2006-11-23 18:34:51
·
answer #5
·
answered by UMkvec 2
·
0⤊
0⤋
You can try simple Decimal/Binary Conversion Tool
http://acc6.its.brooklyn.cuny.edu/~gurwitz/core5/nav2tool.html
Right answer will be 1111001.
2006-11-23 18:32:15
·
answer #6
·
answered by oleg_arch 2
·
0⤊
3⤋
You can check your answers using the windows calculater in Scientific mode.
http://planetmath.org/encyclopedia/BaseConversion.html
2006-11-23 18:43:19
·
answer #7
·
answered by maka 4
·
0⤊
3⤋