# The Cantor function is surjective and continuous

How can I prove that the Cantor function is surjective and continuous?

The part, I think that the cantor function is monotonic and surjective, if I prove this, it is easy to prove that this implies continuity. The way to prove that is surjective, it's only via an algorithm, I don't know if this can be proved in a different way, more elegant. And the monotonicity I have no idea, I think that it's also via an algorithm.

Thanks

-
See Problems in real and complex analysis By Bernard R. Gelbaum, pages 17 and 155. – Martin Sleziak Oct 19 '11 at 18:20
Comment (I don't have enough points to post a comment, sorry): A delta-epsilon proof is not too hard. – gary Oct 19 '11 at 20:49

Let $f$ be the Cantor function. Let $y\in[0,1]$. Let $0.d_1d_2d_3\ldots$ be the binary expansion of $y$. Let $x$ be the number whose ternary expansion is $0.(2d_1)(2d_2)(2d_3)\ldots\ {}$. Then $f(x)=y$. For numbers with non-unique binary expansions, one gets two ternary expansions that do not represent the same number; call them $x_1 < x_2$. Then for all $x\in [x_1,x_2]$, $f(x)=y$.