Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2007-11-09 07:06:11

rune2402
Banned
Registered: 2007-10-23
Posts: 32

Converting between bases other than 10

I would like to learn how to convert from any base to any other base.

I already know how to convert from decimal to any base and from any base to decimal.

My question:

Can I covert between bases by using the decimal base as an intermediary step.

I mean say I have to convert from say base seven to base 5. Can I convert from base seven to base 1o, and then from base 10 to base 5 effectively?

Offline

#2 2007-11-09 13:08:43

rune2402
Banned
Registered: 2007-10-23
Posts: 32

Re: Converting between bases other than 10

The answer is yes.

Offline

#3 2007-11-09 23:43:18

JohnnyReinB
Member
Registered: 2007-10-08
Posts: 453

Re: Converting between bases other than 10

I never thought that you could do that without converting first to base ten


"There is not a difference between an in-law and an outlaw, except maybe that an outlaw is wanted" wink

Nisi Quam Primum, Nequequam

Offline

#4 2007-11-10 00:07:35

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

Re: Converting between bases other than 10

example johnny. (let b[n] be the current base of the number)

converting to base 10 as an intermediate step

123b4 -> 1×4²+2×4+3 = 27b10
27b10 -> 16+11 -> 16+8+3 -> 16+8+2+1 = 11011b2
123b4 = 11011b2 = 27b10

to convert straight to another base, you have to go through each digit like this:

123b4:

3b4 = 1b4 + 2b4 = 1b2 + 10b2 = 11b2
20b4 = 2b4×10b4 = 10b2×100b2 = 1000b2
100b4 = 1b4×10b4×10b4 = 1b2×100b2×100b2 = 10000b2

123b4 = 11b2 + 1000b2 + 10000b2 = 11011b2 = 27b10

its clearly a bit more long-winded, but it does work.

then back to base 4

11011b2:

1b2 = 1b4
10b2 = 1b2×10b2 = 1b4×2b4 = 2b4
1000b2 = 1b2×10b2×10b2×10b2 = 1b4×2b4×2b4×2b4 = 2b4×10b4 = 20b4
10000b2 = 10b4×10b4 (from above) = 100b4

11011b2 = 1b4 + 2b4 + 20b4 + 100b4 = 123b4

the reason why i go through each digit like that, is it means that any addition does not carry forward to the next digit, so you don't have to worry about adding numbers of more than 1 digit of different bases which i find confusing.

Last edited by luca-deltodesco (2007-11-10 00:12:06)


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

Board footer

Powered by FluxBB