Variation of fat Cantor Sets -- Help needed with the sum of a sequence with relationship between $a_n$ and $S_{n-1}$ I am having trouble with finding the infinite sum of the sequence $\{a_n\}$ with the relationship
$$ a_1 = r, \; a_n = r^n(1-S_{n-1})$$ where $$ S_{n-1} = \sum_{k=1}^{n-1} a_k, \; 0<r<1$$
I tried to subtract $$S_{n-1} = 1- \frac{a_n}{r^n}$$ from $$S_{n} = 1- \frac{a_{n+1}}{r^{n+1}}$$
and after some simplification I got
$$\frac{a_{n+1}}{a_n} = r(1-r^n)$$
Could anyone help me to calculate $\sum_{n=1}^\infty a_n$ based on the relationships above? Many thanks!!

Edit: I thought this is a rather technical question so I didn't provide the background of why I am doing this in the first place. Now I see why it might help. I am considering a variation of 'fat Cantor sets' which is obtained by varying the ratio removed at each step. To be precise, starting from the unit interval $K_0 = [0,1]$, we remove the middle open subinterval $G^1_1$ such that $\ell(G^1_1)/\ell(K_0) = r$, for some $r \in (0,1)$. Call the remaining intervals $K_1$. Next, we remove the middle open subintervals $G^2_1$ and $G^2_2$ such that $\mu(G^2_1 \cup G^2_2)/\mu(K_1) = r^2$. Continuing in this fashion such that the measure of intervals removed at step $n$ is of proportion $r^n$ to the measure of the original intervals. Denote $\mu(\bigcup_{m=1}^{2^{n-1}}G_m^n) = a_n$ the length of intervals removed at step $n$, $n \geq 1$. We therefore have the relation $a_n = r^n(1-S_{n-1})$. In other words, the length of the subintervals removed at each step is of proportion $r^n$ to the original interval, which equals r^n*(1 - sum of the length of intervals removed in previous steps). I am interested in finding $\sum_{n=1}^\infty a_n$, which is the total length removed in this construction.
 A: Actually you can simply take the product of the ratios and then get
$$
a_{n+1} = r^{n+1}\prod_{i=1}^{n}(1-r^{i}),
$$
then substitute it into the formula of $S_{n}$ we obtain
$$
S_{n} = 1 - \prod_{i=1}^{n}(1-r^{i})\rightarrow 1-\phi(r),\quad n\rightarrow \infty,
$$
where $\phi$ is the Euler function. A graph of the Euler function by Wolframalpha is shown here (Original link: https://mathworld.wolfram.com/q-PochhammerSymbol.html).

Actually here is another way to construct the Cantor set with arbitrary length:
(i) Remove an open interval $G^{1}_{1}$ of length $3^{-1}\varepsilon$ from the middle of $[0,1]$, and get two closed sub-intervals $F^{1}_{1}$, $F^{1}_{2}$; (ii) Remove two open intervals $G^{2}_{1}$, $G^{2}_{2}$ of length $3^{-2}\varepsilon$ from the middle of each closed interval $F^{1}_{1}$ and $F^{1}_{2}$, and get four closed sub-intervals $F^{2}_{1}$, $F^{2}_{2}$, $F^{2}_{3}$, $F^{2}_{4}$; $\ldots$ Remove $2^{n-1}$ open intervals $G^{n}_{1}, G^{n}_{2}, \ldots, G^{n}_{2^{n-1}}$ of length $3^{-n}\varepsilon$ from the middle of each closed interval $F^{n-1}_{1}, F^{n-1}_{2}, \ldots, F^{n-1}_{2^{n-1}}$, and get $2^{n}$ closed sub-intervals $F^{n}_{1}, F^{n}_{2}$, $\ldots, F^{n}_{2^{n}}$. So on and so forth. Then let $G$ be the union of the disjoint open intervals $G^{n}_{i}$, i.e.,
$$
G = \bigcup_{n=1}^{\infty}\bigcup_{i=1}^{2^{n-1}} G^{n}_{i}, 
$$
then $G$ is open, and we have
$$
\mathcal{L}^{1}(G) = \sum_{n=1}^{\infty} \sum_{i=1}^{2^{n-1}} \mathcal{L}^{1}(G^{n}_{i}) = \sum_{n=1}^{\infty} 2^{n-1} 3^{-n} \varepsilon = \varepsilon.
$$
