Converting Unbalanced Ternary Numbers to Balanced Ternary Number
Emily Wong
Can someone please provide a step by step algorithm for converting unbalanced ternary to balanced?
for instance: (Base 10) 501 = (Base 3 Unbalanced) 200120
I've done some research on this conversion but I've been unsuccessful in my efforts to obtain a good understanding of the process.
I understand that 0 can be represented as "0" and 1 can be represented as "1". However, I understand 2 can be represented as "+1-1". I'm just unsure of how to use this information to produce a final result in the form of balanced ternary.
Any help will be greatly appreciated.
$\endgroup$1 Answer
$\begingroup$The idea is that in the $3^k$ place you can have either $1, 0, \text {or} -1$. You represent $2$ in balanced ternary with $-1$ in the current place and $+1$ in the next higher place. $-1$ in balanced ternary will be represented by $T$ as in the Wikipedia article. Here I will subscript unbalanced with $u$ and balanced with $b$, with all numbers in ternary. The previous point would be that $2_u=1T_b$ To convert unbalanced to balanced, you just start from the bottom and convert each ternary digit, carrying as necessary. If you allow both $2$ and $T$ as digits, numbers have multiple representations but taking your example we can say $200120_u=2002T0=201TT0=1T01TT0_b$ and when we don't have any more $2$'s we are done.
$\endgroup$ 5