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 Directly from Base to Base


Date: 04/01/2001 at 05:48:55
From: Ahmed Khammash
Subject: Number theory

Is there any way of reducing the representation of a natural number 
from one base to another base directly without reducing to base 10 
first?

I tried this by reducing to base 10 first, and in fact this is the 
only way I know.


Date: 04/01/2001 at 17:13:09
From: Doctor Schwa
Subject: Re: Number theory

Hi Ahmed,

I'd bet that the procedure you used for converting the number to
base 10 will also work to convert directly to any other base, though
unless you are a computer it's probably easier to do the arithmetic
in base 10 the way you suggest.

There are a few exceptions, for instance converting base 2 to base 8, 
where the digits simply group in threes:

10,101,111,001 base 2 is the same as 2571 base 8.

That's certainly easier to do without converting to base 10 in the
middle. Similarly, 345 base 9 = 10,11,12 base 3.

But if you want to convert, say, 345 base 7 = ??? base 8,
it's probably easier to convert to base 10 first.

Still, if you insist, you can do the conversion the same way you'd
convert to base 10, only you have to do all the arithmetic in base 7.
In the indented section below, ALL numbers are in base 7.

  We want to convert 345 to base 11.  So, divide by 11:
  345 / 11 = 31 remainder 4, so the one's place is 1.

  31 / 11 = 2, remainder 6, so the 11's place is 6.

  and the quotient 2 / 11 = 0, remainder 2, so the 121's place is 2.

  Hence 345 = 264 (base 11)

Now back to our usual number base:
(345) base 7 = (264) base 8.

The essence of my method is that you can read off the digits from
right to left by dividing by the base and taking the remainder,
then dividing that quotient by the base and taking the remainder,
then dividing that quotient ...

When the numbers are bigger, though, you end up doing long division
in different number bases, which gets very confusing (again, unless
you are a computer), so you're probably better off converting to
base 10 first so you can do all your division in that base.

- Doctor Schwa, The Math Forum
  http://mathforum.org/dr.math/   
    
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/