Cantor Set Homeomorphic to Inverse Limit Space For each positive integer $n$ let $X_n = \left\{1, 2, 3, ..., 2^n \right\}$ with the discrete topology and let $f_n : X_{n+1} → X_n$ be the function defined by:
$f_n(i) = i$ for $1 ≤ i ≤ 2^n$
$f_n(i) = 2^{n+1} − i + 1$ for $2^n < i ≤ 2^{n+1}$
Then 
$X = lim_{←} \left\{X_i, f_i \right\}_{i=1}^{\infty}$
is homeomorphic to the Cantor set.
I've been trying to find a homeomorphism for this for way too long... anyone know what it would be? 
I can take care of proving it's a homeomorphism once I have the function.
Typically when finding a homeomorphism between a set and the Cantor set, I use the fact that a point of the Cantor set can be written as $\sum_{i=1}^{\infty} \frac{a_i}{3^i}$ for $a_i \in \left\{ 0, 2 \right\}$. 
 A: Rewritten, to address issues raised in the comments:
Let me alter your notation slightly for convenience:
$$X_n = \{0,1,2,...,2^{n}-1\}
$$
$$f_n(i) = \begin{cases}
i & \quad\text{if $0 \le i < 2^n$} \\
i - 2^{n-1} & \quad\text{if $2^n \le i < 2^{n+1}$}
\end{cases}
$$
It should be straightforward to work out an isomorphism of inverse sequences between the notation of your question and this new notation.
Using this new notation, each element of $X_n$ can be written uniquely as an $n$-bit binary number 
$$b_n \cdots b_1 = \sum_{i=1}^n b_i \cdot 2^{i-1}
$$
Furthermore, the projection function $f_n : X_{n+1} \to X_n$ can be written as
$$f_n(b_{n+1}b_n \cdots b_1) = b_n \cdots b_1
$$
In other words, $f_n$ simply drops the leading bit. 
It follows from this description that each element of the inverse limit $X$ can be written uniquely as an "infinite binary number" by which I simply mean an infinite bit sequence written in the form $\cdots b_{n+1} \, b_n  \cdots  b_4 \, b_3 \, b_2 \, b_1$. Furthermore every such "infinite binary number" is an element of $X$. To be a bit more precise, and to address your question in the comments, each element of $X$ is an infinite sequence of finite binary numbers which has the form
$$(b_1, \, b_2b_1, \, b_3b_2b_1, \, b_4b_3b_2b_1, \, \ldots)
$$
and we can clearly put such sequences into one-to-one correspondence with infinite bit sequences $\cdots b_{n+1} \, b_n  \cdots  b_4 \, b_3 \, b_2 \, b_1$.
With this notation, we can now define 
$$f(\cdots  b_{n+1} \, b_n \cdots  b_4 \, b_3 \, b_2 \, b_1) = \sum_{i=1}^\infty \frac{2b_i}{3^{i-1}}
$$
