3.2.1 Converting Integers
One of the topics I’ve found rather difficult teaching to students is the concept of changing bases. It seems that students have the concept of a base-10 system so ingrained in their mind (almost always unbeknownst to them) that it is difficult considering other base systems. Hopefully this section will be a good introduction to the process of changing bases and doing basic operations in other number systems. First, let’s observe how we look at numbers in the usual base-10 fashion.
Everyone knows that 1254 means that you have one-thousand, two-hundred, and fifty-four of something, but expressing this in an unusual manner we can say:
From this we can see where this concept of “base-10” comes from, we are adding combinations of these powers of tens (depending on what digit we multiply by). So, you can express any integer in base-10 as:
Where all ’s are integers ranging from .
The fact that we are summing these various powers of 10 is completely an arbitrary one. We can easily change this to some other integer (like 6 for example) and develop a base-6 number system. Let’s see what it would look like:
Where all ’s are integers ranging from .
So to use an example, let look at what the number (where the subscript denotes we are in base-6) would look like in our usual base-10 system:
From this we have found the way to convert any base-n whole number to base-10!
Let’s look at another example:
So now that we know how to convert from base-n to base-10, let’s look at the process on how to convert the opposite direction:
- Find the highest power of which divides the base-10 number (let’s say it is the -th power).
- Figure out how many times it divides it and that will be your -th digit in base-n.
- Take the remainder and figure out how many times one less than the highest power divides it (so see how many times divides it). That is your -th digit.
- Take the remainder, and continue process.
I know that this might seem complicated, but let’s look at an example we have already done in the “forward” direction to illustrate how to go “backwards.” Convert to base-6:
- Well we know and , so the highest power which divides 51 is .
- 36 goes into 51 one time, so our 3rd digit is 1.
- The remainder when dividing 51 by 36 is 15.
- Now we see how many times goes into 15 (which is 2 times, so our 2nd digits is 2).
- The remainder when dividing 15 by 6 is 3.
- divides 3 obviously 3 times, so our 1st digit is 3
- So after conversion, , which corresponds to what we expected.
As a warning, some digits might be zero when you do the base conversion. Let’s look at an example of this: Convert to base-4:
and , so goes into 18 once with a remainder of 2: Third Digit is 1 Now doesn’t go into 2: Second Digit is 0 goes into 2 twice: First Digit is 2 Answer:
This seems like a lot of steps in making a base conversion, but after substantial practice, it will become second nature. Here are some practice problems with just converting bases from base-n to base-10 and reverse.