TITLE: Cantor set in base 3.
QUESTION [14 upvotes]: I'm trying to prove the cantor set $C$ is equivalent to the set of all numbers with ternary expansion of $2$'s and $0$'s. That is:
Let $A_0=[0,1]$. $A_n$ is defined to equal $A_{n-1}$ with it's middle third removed. let $C=\bigcap_{n\in\mathbb{N}} A_n$.
 Prove $C =\{x=0.a_1a_2a_3...| a_n\in\{0,2\} \text{ for all }n\in\mathbb{N} \} $ where the decimal expansion is in base $3$.
Let $x=0.a_1a_2a_3...$ $\space$ be a ternary expansion of $x$ 
My strategy is this:
Prove that $a_n=1 \iff x\notin A_n$

(a) Proceed by induction on $n$.  For $n=1$ we have:
$a_1 = 1 \iff \frac{1}{3} \le  x < \frac{2}{3} \iff x \notin A_1$ 
Assume it's true for $n$ that is:$\space a_n = 1 \iff x \notin A_n$.
For $n+1$ we have: $a_{n+1}=1 \iff \text{there's some integer $m$ such that:} \frac{1}{3} \le 3^{n}x - m  < \frac{2}{3} $ 
Furthermore $m = a_1a_2a_3...a_{n}$ (in base 3 digit expansion). 
Here i got stuck.

REPLY [2 votes]: Below is a nice picture of stages used to create Cantor's Middle thirds set.

One way to go from one stage to the next is to divide the set of all elements by 3 and then add the set increased by $\frac23$. We will only include the endpoints. This can be very easily written in base 3, since in base 3 division by 3 is equivalent to moving the decimal point over one space to the left and adding $\frac23$ is equivalent to adding $0.2$:
Stage 0:
$$
0, 1
$$
Stage 1:
$$
0.0, 0.1; 0.2, 1.0
$$
Stage 2:
$$
0.00, 0.01, 0.02, 0.10; 0.20, 0.21, 0.22, 1.00
$$
Stage 3:
\begin{align*}
         &0.000, 0.001, 0.002, 0.010, 0.020, 0.021, 0.022, 0.100;\\
         &0.200, 0.201, 0.202, 0.210, 0.220, 0.221, 0.222, 1.000
\end{align*}
Note that $0.\bar{2} = 1$, so we can actually rewrite the elements at Stage 0 using only 0s and 2s and we will never add any 1s as we move from one stage to the next. Hence, the Cantor Set is precisely the set of all decimals written in base 3 using only digits 0 and 2. This can be easily shown by induction, since at any stage $n$ we have all $2^n$ possible $n$-digit combinations of 0s and 2s as a finite decimal and we have all those possible combinations followed by $\bar{2}$:
Stage 0:
$$
      0, 0.\bar{2}
$$
Stage 1:
$$
      0.0, 0.0\bar{2}; 0.2, 0.2\bar{2}
$$
Stage 2:
$$
      0.00, 0.00\bar{2}; 0.02, 0.02\bar{2}; 0.20, 0.20\bar{2}, 0.22, 0.22\bar{2}
$$
Stage 3:
\begin{align*}
      &0.000, 0.000\bar{2}, 0.002, 0.002\bar{2}, 0.020, 0.020\bar{2}, 0.022, 0.022\bar{2};\\
      &0.200, 0.200\bar{2}, 0.202, 0.202\bar{2}, 0.220, 0.220\bar{2}, 0.222, 0.222\bar{2}
\end{align*}