Converting Between Bases

I was working through the November problems for NCTM’s Mathematics Teacher. There’s a problem on converting between bases, which led to me developing a new-to-me method.

What I was taught

I started by using the method I’d been taught by my computer programming teachers:

  • Identify the value of each place
  • Divide by the highest value, take the remainder
  • Keep going until your remainder is less than the base

This is an annoying amount of work, leading us to memorize the values for common bases (in programming, those are binary and hexadecimal, and to a lesser extent octal). For instance, to convert decimal 7612 to base six:

  • The place values, in reverse order, are 1, 6, 36, 216, 1296, 7776. We don’t need the last one.
  • Next, divide our conversion value by each place value, starting with the largest, and set the remainder aside. 7612 / 1296 = 5, remainder 1132.
  • 1132 / 216 = 5, remainder 52.
  • 52 / 36 = 1, remainder 16.
  • 16 / 6 = 2, remainder 4.
  • This gives us 55124.

To do it the other way, multiply each place by the appropriate value then add everything up. For instance, to convert base six 12345 to decimal, calculate 1 * 1296 + 2 * 216 + 3 * 36 + 4 * 6 + 5 * 1 = 1865.

What I discovered

This morning, it occurred to me that there’s a different way. It’s perhaps more “work”, but it doesn’t require dividing by large numbers, or even figuring out the place values. This is a variation of a method of multiplication by implicitly converting to binary. So I think it’s simpler, requiring less work in explaining what a base is.

  • To convert from decimal to another base b, divide by b, take the remainder, and repeat until your remainder is less than b.
  • To convert from base b to decimal, multiply the first digit by b, add the next digit, and repeat until you’re out of digits.

Convert decimal 7612 to base six:

  • 7612 / 6 = 1268 remainder 4
  • 1268 / 6 = 211 remainder 2
  • 211 / 6 = 35 remainder 1
  • 35 / 6 = 5 remainder 5
  • 5 / 6 = 0 remainder 5, so we’re done.
  • Reading the remainders up, this gives us 55124

Convert base six 12345 to decimal:

  • 1 * 6 = 6
  • 6 + 2 = 8
  • 8 * 6 = 48
  • 48 + 3 = 51
  • 51 * 6 = 306
  • 306 + 4 = 310
  • 310 * 6 = 1860
  • 1860 + 5 = 1865, and we’re done

This technique has bits from other techniques I’ve seen, but since I’ve never seen it presented in this way, I figured it might be worth sharing.

Leave a Comment

Your email address will not be published. Required fields are marked *