Visualization of Cantor set by Mathematica or Maple!

We all know what it is the Cantor set. The Cantor set is created by repeatedly deleting the open middle thirds of a set of line segments. One starts by deleting the open middle third $(\frac{1}{3}, \frac{2}{3})$ from the interval $[0, 1]$, leaving two line segments: $[0, \frac{1}{3}] ∪ [\frac{2}{3}, 1]$. Next, the open middle third of each of these remaining segments is deleted, leaving four line segments: $[0, \frac{1}{9}] ∪ [\frac{2}{9}, \frac{1}{3}] ∪ [\frac{2}{3}, \frac{7}{9}] ∪ [\frac{8}{9}, 1]$. This process is continued ad infinitum, where the nth set. The Cantor ternary set contains all points in the interval $[0, 1]$ that are not deleted at any step in this infinite process. An explicit formula for the Cantor set is $$C=[0,1]\bigcup_{m=1}^{\infty}\bigcup_{k=0}^{3^{m-1}-1}(\frac{3k+1}{3^m},\frac{3k+2}{3^m})$$

I know Maple just for doing some calculus and some basic modeling. I am asking if someone can note me a program in which we visualize the Cantor set. As I don't know if this job can be done in Maple, I added Mathematica in the title. Maybe its environment is more powerful than Maple in this question. Thanks.

-
The CDF is maybe a bit easier to parse visually. See page 77 of [these lecture notes][1] by Gordan Zitkovic. [1]: ma.utexas.edu/users/gordanz/notes/theory_of_probability_I.pdf –  yep Jul 8 '12 at 8:52

The Cantor $\frac13$ set is kind of hard to visualize, since it has infinitely many points but zero Lebesgue measure. The best visualization I could think of was to plot an approximation of its indicator function:

> f := a -> [seq(x/3, x in a), seq((2+x)/3, x in a)]:
> cantor := n -> (f@@n)([0,1]):
> delta2plot := points -> [seq(seq([x,y], y in [0,1,0]), x in points))]:
> plots:-listplot(delta2plot(cantor(5)), color=gray, view=[0..1,0..1]);


$\hspace{110px}$

-
-
Thanks. I didn't know it was done before! –  Babak S. Jul 5 '12 at 18:52