# Figured out quick equation to convert 6 bit binary nums

Discussion in 'Math' started by count_volta, Mar 18, 2011.

1. ### count_volta Thread Starter Active Member

Feb 4, 2009
435
24
I was working on my binary clock and realized I need a way to quickly convert binary 0-60 without going through the whole 1*2^3+1*2^1 + ...... or else it would make my clock pointless.

This formula works for any number from 0-63. I am certain there is another likewise simple equation for numbers with more bits, and maybe this topic will challenge you guys to determine it.

Say you have a 6 bit binary number ABCDEF where A is the MSB and F is the LSB.

To convert to base 10, you do the following.

((ABC in base 10)*8) +(DEF in base 10).

All it requires you to remember is binary numbers 0-7, and most people can already do that.

So okay, now figure out a formula for 8 bits. Go!!!!

Last edited: Mar 18, 2011

Jul 7, 2009
1,585
141
That's octal to decimal... You can do the analogous thing with any base that's a power of 2 -- just group the bits appropriately.

3. ### count_volta Thread Starter Active Member

Feb 4, 2009
435
24
Figured it out for 10 bit numbers also.

Say you have an 8 bit number ABCDEFGH

To convert to base 10, you do

((ABCD in base 10) *16) + (EFGH in base 10)

This requires you to know 0-15 in binary. That is pretty much all I memorized. Anything higher than 16, I gotta convert. LOL.

Just imagine you can convert any number from 0-255 in mere seconds, in your head!!!

To be honest this is only useful on exams where your professor does not allow calculators. At work you can use calculators, and even supercomputers. Whatever you want.

Lets do an example:

Convert the following binary number:

01100100

First: 0110 is 6.
Second: 16*6 = 96
Third: 0100 is 4.
Fourth: 96 +4 = 100

We check using a calculator, and indeed 01100100 = 100 in decimal.

someonesdad is right, this will work for any power of 2. The next one (10 bits) requires you to memorize 0-31 in binary. Little tougher, but if you can, you can convert any number from 0-1023 in your head in seconds!!!

Last edited: Mar 18, 2011
4. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
A good computer algorithm is to divide by two, over and over. If the answer is not even it is a 1, if it is even it is a 0.

273/2=136.5 1
136/2=68.....0
68/2=34.......0
34/2=17.......0
17/2=8.5......1
8/2=4..........0
4/2=2..........0
2/2=1..........0

273 Decimal = 10001000 Binary

5. ### Markd77 Senior Member

Sep 7, 2009
2,803
595
Something went wrong:
273 decimal = 100010001 binary

6. ### Wendy Moderator

Mar 24, 2008
21,012
2,745
Forgot the last step...

273/2=136.5 1
136/2=68.....0
68/2=34.......0
34/2=17.......0
17/2=8.5......1
8/2=4..........0
4/2=2..........0
2/2=1..........0
1/2=0.5.......1

273 Decimal = 100010001 Binary

The number is read backwards, least significant digit first.

OK, something simpler, Decimal 11

11/2=5.5 1
5/2=2.5 . 1
2/2=1 .... 0
1/2=0.5 . 1

1011

or Decimal 12
12/2=6 .0
6/2=3 . 0
3/2=1.5 1
1/2=0.5 1

1100