0

The number I am trying to convert is 212122101212, from base 3 to base 9.

The way I tried doing it is converting the number to base 10 by multiplying each digit with weight of corresponding power of 3. And then convert this to base 9 by repeatedly diving the number by 9 and keeping the remainder.

Since it's a very large number I committed mistakes couple of times while converting it manually. Is there any better, less error prone, way of converting the number?

Rakesh K
  • 123
  • 2
    Note that $9 = 3^2$. Can you easily convert a number from base $10$ to base $100$? – Daniel Fischer Oct 25 '16 at 13:49
  • It doesn't really make sense to convert a number to base 10 as an intermediate step. If you know how to convert form base 3 to 10, then you know how to convert directly from base 3 to any other base. There's nothing special about 10. – Jack M Oct 25 '16 at 14:59

2 Answers2

0

$212122101212_3=21|21|22|10|12|12=(2 \times 3+1\times1)3^{10}+(2\times3+1\times1)3^8+(2\times3+2\times1)3^6+(1\times3+0\times1)3^4+(1\times3+2\times1)3^2+(1\times3+2\times1)3^0=7\times9^5+7\times9^4+8\times9^3+3\times9^2+5\times9^1+5\times9^0=778355_9$

0

Generally, if you are converting from base $n$ to base $n^m$, you can do it by taking the original number $m$ digits at a time starting from the right.

So in your case, take the number 2 digits at a time starting from the right. $21-21-22-10-12-12$ in base 3 converts to $7-7-8-3-5-5$ in base 9($3^2)$ so your answer is $778355$

turkeyhundt
  • 7,733