This post will be of special interest for people who are regularly in touch with mathematics. Students preparing for competitive examinations usually have Base System (Number Systems) in the list of their topics under quantitative aptitude.
Conversion from decimal to binary and other number bases
In order to convert a decimal number into its representation in a different number base, we have to be able to express the number in terms of powers of the other base. For example, if we wish to convert the decimal number 100 to base 4, we must figure out how to express 100 as the sum of powers of 4.
100 = (1 x 64) + (2 x 16) + (1 x 4) + (0 x 1)
= (1 x 4^3) + (2 x 4^2) + (1 x 4^1) + (0 x 4^0)
Then we use the coefficients of the powers of 4 to form the number as represented in base 4:
100 = 1 2 1 0 base 4
Take another example; convert 117 into binary system –
Now since we have to convert 117 into binary we have to express 117 as the sum of the powers of 2. Obviously all the powers need to be less than 128 (=2^7)
117 = (1 x 64) + (1 x 32) + (1 x 16) + (0 x 8 ) + (1 x 4) + (0 x 2) + (1 x 1)
117 in decimal = 1110101 in binary
This method is less of calculation and more of application of mind and needs a lot of practice to master.
The other way to do this, which is more frequently used, is to repeatedly divide the decimal number by the base in which it is to be converted, until the quotient becomes zero. As the number is divided, the remainders - in reverse order - form the digits of the number in the other base.
Example: Convert the decimal number 82 to base 6:
Solution: 82/6 = 13 remainder 4
13/6 = 2 remainder 1
2/6 = 0 remainder 2
The answer is formed by taking the remainders in reverse order: 214 in base 6
In my next post, I will write about converting other number bases to decimal number system.
You can suggest any addition to the post below by posting a comment or mailing me at vineetpatawari[at]gmail[dot]com. If you have any queries post it as comment.