Maximum possible value of infinite series $a$ is the real number. For each $0\leq n$, $a_n$ is the distance from $a$ to the nearest rational number of the form: $\frac{m}{2^n}$, where $m$ is integer. What is the maximum possible value of $\sum\limits_{n=0}^{\infty}a_n$?
I have find http://en.wikipedia.org/wiki/Blancmange_curve and also, I guess, the answer is less than $\sum\limits_{n=1}^{\infty}\frac{1}{2^n}=1$. I will be grateful for help.
 A: Let $\phi(x) = \min( x - \lfloor x \rfloor, \lceil x \rceil - x)$ be the distance of $x$ to its nearest integers. It is a periodic function with period $1$ and reaches its maximum value 
$\frac12$ at $x = \frac12 + k, k\in \mathbb{Z}$. The sum we want can rewritten as
$$\sum_{n=0}^\infty a_n = \sum_{n=0}^{\infty} 2^{-n}\phi(2^n x) = \sum_{n=0}^{\infty} 4^{-n}\psi(4^n x)$$
where $\psi(x) = \phi(x) + 2^{-1}\phi(2x)$. Notice $\psi(x)$ is a periodic function
with period $1$, reaches its maximum value $\frac12$ on $\bigcup\limits_{k\in\mathbb{Z}} [\frac14+k,\frac34+k]$. We immediately find for all $x$,
$$\sum_{n=0}^\infty 4^{-n}\psi(4^n x) \le \frac12 \sum_{n=0}^\infty 4^{-n} = \frac23 \tag{*1}$$
Now at points like $x = \frac13$, we have $4^n \times \frac13 = \frac{4^n - 1}{3} + \frac13$. Since $3 \mid 4^n -1$, we have $\psi(4^n\times\frac13) = \psi(\frac13) = \frac12$.
This means the value $\frac23$ in RHS of $(*1)$ is reachable. As a result, the maximum possible value of the sum is $\frac23$.
A: Ok suppose $a\in\mathbb{R}$ and $a_n = \min\limits_{m\in\mathbb{N}} \left|\frac{m}{2^n}-a\right|$
Then we get that:
$$ \forall m\in\mathbb{N} \quad \left|\frac{m}{2^n} - a\right| < \frac{1}{2^n}$$
Suppose this was not true, then there is a distance $d\ge\frac{1}{2^n}$. For this distance there exists a $k\in\mathbb{N}$ the biggest number with $d\ge\frac{k}{2^n}$.
Then for:
$$m^*_{1,2} = m\pm k \quad\text{with}\quad \left|\frac{m_i^*}{2^n}-a\right| < \frac{1}{2^n} \quad \text{for} \quad i\in\{1,2\}$$
Meaning:
$$ \sum_{n=0}^\infty a_n < \sum_{n=0}^\infty \frac{1}{2^n} = 1 $$
So yes indeed!
