0
$\begingroup$

I have a problem. I am very good at converting numbers from base to base after going through base 10. The question is, how can I do the conversions without going through base 10?

Thanks

$\endgroup$
  • $\begingroup$ How is the number given to you initially? If it is in base $10$ you need base $10$. $\endgroup$ – Jorge Fernández Hidalgo Sep 21 '15 at 0:30
2
$\begingroup$

You just do long division, remembering that you work in a different basis.

For example let us say that we want to change $254_{6}$ to basis $4$.

Since we have to divide by $4$ let us start by making the multiplication by $4$ table for basis $6$: $$4 \times 0 =0 ; 4 \times 1 =4 ; 4 \times 2 =12 ; 4 \times 3 =20 ; 4 \times 4 =24 ; 4 \times 5=32$$

Now by long division we get $25_{(6)}:4$ has $q=4, r=1$ and $14_{(6)}:4$ has $q=2, r=2$. This gives $$ 254_{(6)}:4 ; q=42, r=2$$

This gives us that the last digit is $2$.

Now when we divide $42_{6}$ to $4$ we get $q=10, r=2$. Thus second last digit is $2$.

Finally $10_{(6)} :4$ gives $q=1$ and $r=2$. The third last digit is $4$ and the first digit is $1$.

This gives $$254_{(6)}=1222_{(4)}$$

$\endgroup$
0
$\begingroup$

I don't really think there's an alternative better than going through base $10$, in general. Here's an example.

Let's say we wanted to convert $(261)_8$ to base $5$.

Using base $10$, we know that $(261)_8 = 2 \cdot 8^2 + 6 \cdot 8^1 + 1 \cdot 8^0$, where even this expansion depends on the fact that our "coefficients", the multipliers of our various powers of $8$, are being expressed base $10$ (not to mention the base itself, $8$).

If we were to jump straight into base $5$, then since $8 = (13)_5$, we'd have something like

$$(261)_8 = (2)_5 \cdot \big((13)_5\big)^2 + (11)_5 \cdot \big((13)_5\big)^1 + (1)_5 \cdot \big((13)_5\big)^0. $$

Now, is it impossible to compute entirely in base $5$? No, of course not; we have for example

$$ (2)_5 \cdot \big((13)_5\big)^2 = (2)_5 \cdot (224)_5 = (1003)_5 $$

using the standard addition/multiplication algorithms but in base $5$, but I find such a thing terribly unpleasant, given the alternative! Not to mention, we have two more of those, plus the final additions before we're done.

Probably for certain conversions there are shortcuts (between powers of $2$, say), but in general, I would not hesitate to use base $10$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.