Cantor ternary set problem Let C be a cantor ternary set
If $x,y \in C,$ then obviously $x-y \in [-1,1]$
Conversely I want to prove that 
if $w \in [-1,1],$ then there exists $x,y \in C$ such that $x-y=w$
How to prove this problem?
 A: Let $w$ in $[-1,1]$, then $w=-1+2u$ with $u$ in $[0,1]$. Like every number in $[0,1]$, $u$ can be written in base $3$, that is, as a series of negative powers of $3$, namely,
$$
u=\sum\limits_{k\geqslant1}\frac{u_k}{3^k},\qquad u_k\in\{0,1,2\}.
$$
Let $w_k=2u_k-2$, hence $w_k$ is in $\{-2,0,2\}$. Then 
$$
w=-1+\sum\limits_{k\geqslant1}\frac{w_k+2}{3^k}=\sum\limits_{k\geqslant1}\frac{w_k}{3^k}.
$$
For every $k\geqslant1$, define 


*

*$x_k=0$ and $y_k=2$ if $w_k=-2$, 

*$x_k=y_k=0$ if $w_k=0$, 

*and $x_k=2$ and $y_k=0$ if $w_k=2$. 


Then $w_k=x_k-y_k$ for every $k$ hence $w=x-y$ with 
$$
x=\sum\limits_{k\geqslant1}\frac{x_k}{3^k},\qquad
y=\sum\limits_{k\geqslant1}\frac{y_k}{3^k}.
$$
Since $x_k$ and $y_k$ are in $\{0,2\}$ for every $k$, both $x$ and $y$ are in $C$.
A: HINT: It obviously suffices to show that $(0,1]\subseteq C-C$. Let $w\in(0,1]$, and let $$w=\sum_{k\ge 1}\frac{w_k}{3^k}$$ be a ternary expansion of $w$ (i.e., each $w_k\in\{0,1,2\}$). Suppose that $$x=\sum_{k\ge 1}\frac{x_k}{3^k},~y=\sum_{k\ge 1}\frac{y_k}{3^k}\in C\;,$$ where each $x_k,y_k\in\{0,2\}$, and that $y=w+x$. Let $\oplus$ be addition mod $3$. Then for each $k\in\Bbb Z^+$ $y_k$ is either $w_k\oplus x_k$ or $w_k\oplus x_k\oplus 1$. Prove the following lemma.

Lemma. For each $k\in\Bbb Z^+$, if $y_k=w_k\oplus x_k\oplus 1$, then either $y_{k+1}=w_{k+1}\oplus x_{k+1}\oplus 1$ and $w_{k+1}\in\{0,2\}$, or $y_{k+1}=w_{k+1}\oplus x_{k+1}$ and $w_{k+1}=1$, and if $y_k=w_k\oplus x_k$, then either ${k+1}=w_{k+1}\oplus x_{k+1}$ and $w_{k+1}\in\{0,2\}$, or $y_{k+1}=w_{k+1}\oplus x_{k+1}\oplus 1$ and $w_{k+1}=1$.

Now define a function $\varphi:\Bbb Z^+\to\{0,1\}$ recursively as follows: $\varphi(1)=1$ iff $w_1=1$, and for every $k\in\Bbb Z^+$
$$\varphi(k+1)=\begin{cases}
1-\varphi(k),&\text{if }w_{k+1}=1\\
\varphi(k),&\text{otherwise}\;.
\end{cases}$$
For each $k\in\Bbb Z^+$ use $\varphi(k)$ and $w_k$ to construct $x_k$ and $y_k$.
(There are other ways to prove the theorem, but this one is very constructive.)
