Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Converting Base Numbers Directly Without Using Base 10

Date: 01/26/2004 at 01:53:32
From: John
Subject: Bases changes

How do you convert from one base to another without going through base
10?  I understand conversions between binary based bases, but how do I
go from base 3 to base 7, for instance?  Would the same algorithm work
to go from base 5 to base 12?



Date: 01/26/2004 at 13:14:00
From: Doctor Greenie
Subject: Re: Bases changes

Hi, John --

The process is straightforward and can be used to convert between any
two bases.  But to use it you need to be proficient in the arithmetic
of both the bases you are working with.  The key to the process is the
method you use to evaluate a number in a particular base.

Given the base-10 number "1234", there are two basic ways to evaluate it:

(1)  (using place values)

  1*1000 + 2*100 + 3*10 + 4 = 1000 + 200 + 30 + 4 = 1234

(2)  ("building" the number from left to right using only the base)

With this method, you start from the left in the number; for each 
digit, you add that digit and then multiply by the base:

  1                ["add" the next (first) digit]
  1 * 10 = 10      [multiply by the base]
  10 + 2 = 12      [add the next digit]
  12 * 10 = 120    [multiply by the base]
  120 + 3 = 123    [add the next digit]
  123 * 10 = 1230  [multiply by the base]
  1230 + 4 = 1234  [add the next digit]

I used a base-10 example first so you could see the process; let's use
the two methods to evaluate 1234 (base 5):

(1)  (using place values)

  1*125 + 2*25 + 3*5 + 4 = 125 + 50 + 15 + 4 = 194

(2)  ("building" the number from left to right using only the base)

  1
  1 * 5 = 5
  5 + 2 = 7
  7 * 5 = 35
  35 + 3 = 38
  38 * 5 = 190
  190 + 4 = 194

You can convert directly between any two bases using the second method
described above--you just need to be able to do the required
arithmetic in the bases you are working with.  Following is a
demonstration of the conversion

  1234 (base 5) = ??? (base 7)

We use method (2) above, doing the arithmetic in base 7....

  1 * 5 = 5
  5 + 2 = 10  (again, you need to know that 7 in base 7 is 10)
  10 * 5 = 50
  50 + 3 = 53
  53 * 5 = 361
  361 + 4 = 365

Note that the arithmetic is all in base 7 (the "new" base), while the
multiplication at each stage is by 5 (the "old" base).

Checking this result--by evaluating 1234 (base 5) and 365 (base 7)
using our familiar base-10 arithmetic--we have

  1234 (base 5):

  1
  1 * 5 = 5
  5 + 2 = 7
  7 * 5 = 35
  35 + 3 = 38
  38 * 5 = 190
  190 + 4 = 194

  365 (base 7):

  3
  3 * 7 = 21
  21 + 6 = 27
  27 * 7 = 189
  189 + 5 = 194

And one more example: following is a demonstration of the conversion

  1234 (base 7) = ??? (base 5)

We use method (2) above, doing the arithmetic in base 5.  Note that in
this example the (base 5) arithmetic is complicated by the fact that
our multiplier (the old base, 7) is "12" in base 5....

  1
  1 * 12 = 12
  12 + 2 = 14
  14 * 12 = 223
  223 + 3 = 231
  231 * 12 = 3322
  3322 + 4 = 3331

To check this result, we use our familiar base-10 arithmetic to
evaluate both 1234 (base 7) and 3331 (base 5):

  1234 (base 7):

  1
  1 * 7 = 7
  7 + 2 = 9
  9 * 7 = 63
  63 + 3 = 66
  66 * 7 = 462
  462 + 4 = 466

  3331 (base 5):

  3
  3 * 5 = 15
  15 + 3 = 18
  18 * 5 = 90
  90 + 3 = 93
  93 * 5 = 465
  465 + 1 = 466

If you followed the preceding examples with pencil and paper, trying 
to perform the additions and multiplications in the unfamiliar bases,
you probably had considerable difficulties.  For this reason, when
converting between two unfamiliar bases, it is easier to convert first
from the "old" base to base 10 and then from base 10 to the "new"
base, because all the arithmetic in both those steps can be done in
our familiar base 10.

I hope all this helps.  Please write back if you have any further
uestions about any of this.

- Doctor Greenie, The Math Forum
  http://mathforum.org/dr.math/ 
Associated Topics:
High School Number Theory
Middle School Number Sense/About Numbers

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/