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 Bases Without Going through Base 10

Date: 09/08/2002 at 12:02:31
From: Sarah Naegele
Subject: Base conversions

Is there a way to convert between bases without going through base 10?


Date: 09/08/2002 at 16:14:42
From: Doctor Jerry
Subject: Re: Base conversions

Hi Sarah,

Yes, but it's a bit awkward. To keep the discussion simple, I'll
assume that the number in question is an integer.

Suppose x is a number in base b and we want to convert it to a number 
in base a. So, we originally have

   x = p_0 + p_1*b + p_2*b^2 + ... + p_n*b^n,

where p_0 means p sub 0 and so on. The integers p_0, p_1,...,p_n are 
chosen from 0,1,...,b-1.  This means that the base b representation 
of x is p_n p_{n-1}...p_1 p_0.

We want to express x as   

   x = q_0 + q_1*a + q_2*a^2 + ... + q_m*a^m,

where the integers q_0, q_1,...,q_m are chosen from 0,1,...,a-1.

We know that

q_0 + q_1*a + q_2*a^2 + ... + q_m*a^m 

                  = p_0 + p_1*b + p_2*b^2 + ... + p_n*b^n

We divide both sides by a (doing this in, say, base b arithmetic).  
The left side will be 

q_0/a + (q_1 + q_2*a^1 + ... + q_m*a^{m-1}).

The right side (on which we will do the arithmetic in base b) will be, 
after division, a quotient  Q_1 and a remainder f_1. The remainder 
f_1 is q_0. We repeat this process with the quotient, thus peeling off 
the "digits" one by one.

Suppose we have 102 in base 5 (this is 27 in base 10) and want to 
convert it to base 8 (base 10), that is, to base 13 (base 5).

We divide 102 by 13 and find quotient 3 and remainder 3. So, we're 
finished (in this particular case) and we find 33 (which is 27 in 
base 8).

- Doctor Jerry, The Math Forum
  http://mathforum.org/dr.math/ 


Date: 09/09/2002 at 12:34:51
From: Sarah Naegele
Subject: Thank you (base conversions)

This is exactly what I wanted to know and I followed it completely!
Thank you so much for your time!

- Sarah
Associated Topics:
High School Number Theory

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/