TITLE: Cantor Set and ternary expansions.
QUESTION [5 upvotes]: Does there exists any systematic way to represent a number in ternary expansion?
Also, I have hard time trying to figure it out this:
Let $x = \sum \frac{a_k}{3^k} = 0.a_1a_2.... $
why is it that  $x \in [0,1]$ belongs to the cantor set $C$ iff all its $a_k$ equal $0$ or $2$?
I would really appreciate if someone can explain this to me. Thanks

REPLY [4 votes]: I think the procedure to represent a number in ternary expansion is pretty much the same than representing it in any digit with the only caveat is that you might additionally require that no "tails of zeros" will be allowed in any number different from zero in order to obtain a "unique" representation. The previous answer gives a method.
For instance, in decimal expansion the number $1$ can be written as $.9999999...$ and $.05$ as $.049999...$. The tail of zeros can be replaced by reducing in a unit the preceding digit and then adding an infinite tail of the largest digit in the given expansion. So in base-$4$ you could write $.2=.1333...$.