# Creating a function which lists all points in the cantor set? [closed]

How do we create a function which lists all points of the Cantor set? I want it to be listed as...

C[x_]:=.....


I don't know how to create a nested table which removes the middle thirds of the interval $$[0,1]$$, then $$[1/9,2/9],[7/9,8/9]$$ from $$[0,1],...$$. How do we do this? I am hoping we can include points that are not at the endpoints of the remaining interval such as $$x=1/4,3/10$$.

Edit: I tried using the answer from this post.

cantormesh[0] = {{0, 1}};
cantormesh[n_Integer?Positive] :=
cantormesh[n] =
Join @@ ({{#[[1]], (2 #[[1]] + #[[2]])/3}, {(#[[1]] + 2 #[[2]])/
3, #[[2]]}} & /@ cantormesh[n - 1])


But how do I make the cantor mesh number approach infinity so that I get all the listed points. How do I set up a function using variable n set equal to CantorMesh[n] which lists all these points.

• Pretty sure the function in this answer solves your problem. Apr 23, 2020 at 15:16
• @J.M. I am not sure how to extract the points. A quick answer would be appreciated. Apr 23, 2020 at 16:31
• @Arbuja Have you tried using the code in the linked answer? Have you tried running e.g. cantormesh[3]? You should explain how precisely the output of that function is not what you need? Apr 23, 2020 at 17:35
• @MarcoB I explained in my post. Apr 23, 2020 at 18:57
• "approach infinity so that I get all the listed points" - so if I understood you correctly, you want a list containing infinitely many points, that is infinitely long? Apr 24, 2020 at 0:28

NumberLinePlot[Interval /@ cantormesh[2], Spacings -> 0]