If I were to sum the infinite series:
$$\sum_{i=1}^\infty \frac{1}{2^n} = \frac{1}{2^1}+\frac{1}{2^2}...\frac{1}{2^\infty}$$
but as soon as the previous partial sum $\sum_{i=1}^\infty \frac{1}{2^{n-1}}$ becomes greater than 0.9 I subtract $\frac{1}{2^n}$ instead of adding it, forcing the series to approach 0.9.
What would would be the simplest form to write that, possibly using Iverson brackets? I'm not sure how to deal with the negative value though.
$$\sum_{i=1}^\infty \frac{1}{2^n}.[\sum_{i=1}^\infty \frac{1}{2^{n-1}} < 0.9]$$
or is this valid?
$$\sum_{i=1}^\infty f(n)=\begin {cases} \frac{1}{2^n} & \sum_{i=1}^\infty \frac{1}{2^{n-1}} < 0.9\\ \frac{-1}{2^n} & \sum_{i=1}^\infty \frac{1}{2^{n-1}} > 0.9 \end {cases}$$
or maybe:
$$\sum_{i=1}^\infty f(n)=\begin {cases} \frac{1}{2^n} & \sum_{i=1}^{n-1} \frac{1}{2^n} < 0.9\\ \frac{-1}{2^n} & \sum_{i=1}^{n-1} \frac{1}{2^n} > 0.9 \end {cases}$$
Using Iverson brackets, this can be written as $\sum_{n=1}^\infty f(n)$, where $f(n)$ is defined by $$ f(n)=2^{-n}-2^{-n+1}\left[\sum_{k=1}^{n-1}f(k) \ge0.9\right]. $$ When $n=1$, we use the convention $\sum_{k=1}^0f(k)=0$, as this is the empty sum.
Unlike most function definitions (let $f(n)=n^2$), this one is inductive, so it takes a little thought to convince yourself that it is a valid definition. Since the value of $f(n)$ only depends on the value of $f(k)$ for $k<n$, with the base case $f(1)=1$, there is no problem.