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$?
2 Answers
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:
- Set $n = 0$
- Divide $x$ by $b$, yielding a quotient $q$ and a remainder $r$
- Digit $r_n$ of the answer is $r$
- If $q = 0$, halt; the answer is $r_{n}r_{n-1}\ldots r_0$.
- Set $x = q$, $n = n+1$ and return to step 2
Let's say you want to convert 1e6
(base 17) to base 7.
We set $x = $ 1e6
and $n=0$. We divide $x$ by 7, yielding a quotient of 48
and a remainder of 1, so $r_0 = 1$ and return to step 2.
Now we divide 48
by 7, yielding a quotient of a
and a remainder of 6, so $r_1 = 6$ and we return to step 2.
Now we divide a
by 7 yielding a quotient of 1
and a remainder of 3, so $r_2 = 3$ and we return to step 2.
Now we divide 1
by 7 yielding a quotient of 0
and a remainder of 1, so $r_3 = 1$ and since $q=0$ we halt.
The answer is $1361_7$.

- 65,394
- 39
- 298
- 580
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.

- 616,228
1e
divided by 7 is4
with a remainder of 2;47
divided by 7 isa
with a remainder of 1, so the quotient is4a
and the remainder is 1. – MJD Feb 25 '13 at 14:43q
" refer to the quotient with the remainder, or the quotient without the remainder? – Anderson Green Apr 02 '13 at 00:49