Showing a map from the Cantor set to the Cantor set is continuous Suppose I have a basis for a topology on the cantor set $C$ consisting of intersections of $C$ with the interval components of the $C_i$. Example:for $C_1$, we would have $C \cap [0,1/3]$, and $C \cap [2/3, 1]$ as $2$ basis elements, and continuing on for each $n \in \Bbb N$...
Consider $f_S$:$C \rightarrow C$, for $S \subset \Bbb N$ (potentially $S=\Bbb N$) acting  by changing the ith digit of a base $3$
(ternary) expansion $0.a_1a_2 · · · \in C$ from $0$ to $2$ or vice versa if $i \in S$ and leaving this digit unchanged if $i \notin S$. (I represent $1$ as $0.22222...$).
I am trying ultimately to show that this is a homeomorphism from $C \rightarrow C$, but I am stuck on showing $f$ is continuous. Take a basis element $B$, then it can be represented as a closed interval:
$0.x_1x_2...$ (lower endpoint)
$0.y_1y_2...$ (higher endpoint) where past some element in the sequence,
the sequence is forever $2$ or forever $0$.
As the start of my attempt, I want to show $f^{-1}(B)$ is open in $C$ (or in fact a basis element). The issue I'm having is that if $S=N$, then I'm not sure how to
show that the inverse image is a basis element.
For instance take the interval $[0, 1/3]$, then I imagine that $f([0, 1/3]) = [0, 1/3]$,
but both inclusions are tricky for me at the moment. Any hints appreciated.
 A: Hint: it is really easier to forget about the reals and represent the Cantor set as the product $\{0, 1\}^ω$ of two-point discrete spaces. That is, the elements of the space are infinite sequences of zeros and ones (these correspond to the ternary expansions of reals in $[0, 1]$ using only zeros and twos). The basic sets are sets of all sequences starting with a fixed finite sequence. So the two finite sequences of length one correspond to $C ∩ [0, 1/3]$ and $C ∩ [2/3, 1]$. The finite sequences of length $n$ corresponds to the $2^n$ intersections of $C$ with interval components of $C_n$.
Then you may apply the standard fact that a map $f: X \to ∏_{i ∈ I} Y_i$ is continuous if and only if all compositions $π_i ∘ f$ are continuous.
A: For my specific function take $\epsilon>0$ and $c \in C$, then if $N$ has the property $3^{-N}< \epsilon$, then for any $x \in C$ with $|x-c| < \epsilon$, then 
$|f(c) - f(x)| < \epsilon $ since the first $n$ digits of $c, x$, must be the same, therefore they can differ under $f$ by a maximum of $3^{-n}$, and so $f$ is continuous.
