Artificial intelligent assistant

Repeated iterations of trisection (Cantor sets) I'm trying to build intuition for Cantor sets by doing repeated trisections (and removing the central open interval). Below is one trisection. $$[x,y]\to\left[x,x+\frac{y-x}{3}\right]\cup\left[y-\frac{y-x}{3},y\right]$$ In the above trisection, the central interval $\left(x+\frac{y-x}{3},y-\frac{y-x}{3}\right)$ is removed. Repeated applications trisect each segment created by the prior trisection. Is there a general formula for $n$ trisections?

Assuming you start from $[0,1]$ so the first trisection removes the interval $(\frac13,\frac23)$ then the way I think about it is that $n$th step of trisections (there are $2^{n-1}$ of them) removes those real numbers which when written in ternary (i.e. base $3$) have a $1$ in the $n$th position but not in earlier positions and which are not of the form $\frac{m}{3^n}$ for some integer $m$.

So for example:

* the first trisections removes ternary numbers of the form $0.1\ldots$

* the second set of trisections removes ternary numbers of the form $0.01\ldots$ and $0.21\ldots$

* the third set of trisections removes ternary numbers of the form $0.001\ldots$, $0.021\ldots$, $0.201\ldots$, and $0.221\ldots$




apart from numbers where $\ldots$ represents recurring $0$s or recurring $2$s.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 30805dc14e63dd6265c719eb34b2a651