How can I convert a number from one base, $b_1 \neq 10$ to another base $b_2 \neq 10$ without going through base $10$ i.e. $b_1\rightarrow 10 \rightarrow b_2$?
|
Short answer: You can do it, but you have to do arithmetic in base $b_1$. If you're using a computer, it's easy. If you are using pencil-and-paper, it may be easier to convert through base 10. The algorithm to convert a number $x$ to base $b$ is:
Let's say you want to convert We set $x = $ Now we divide Now we divide Now we divide The answer is $1361_7$. |
|||||||||||||
|
|
If you can do arithmetic in base $b_1$, you can use the technique of repeatedly dividing by $b_2$ and reading off the remainders in reverse order. For example to convert $261_{\text{seven}}$ to base four, you can carry out the following calculation (which is entirely in base seven): $$\begin{align*} 261&=4\cdot50+1\\ 50&=4\cdot11+3\\ 11&=4\cdot2+0\\ 2&=4\cdot0+2 \end{align*}$$ Thus, $261_{\text{seven}}=2031_{\text{four}}$. To see why it works, imagine that we’ve already written the number in base four. The remainder after division by four is just the unit’s (= least significant) digit, and the integer quotient is what’s left when that digit is removed. For the reverse conversion, done entirely in base four: $$\begin{align*} 2031&=13\cdot110+1\\ 110&=13\cdot2+12\\ 2&=13\cdot0+2 \end{align*}$$ Of course the middle digit has to be written $6$ in base seven instead of the base four $12$, but we get $2031_{\text{four}}=261_{\text{seven}}$, as expected. |
|||
|
|