Define a function $\,f:\mathbb{R}\rightarrow \mathbb{R}_{+}$ by: $$ f(x)=\left|x-2\,\left \lfloor \frac{x+1}{2}\right \rfloor \right|. $$
Here are some known properties about the function $f$:
1)$f$ is a 2-periodic function.
2)$f$ is an affine function on every set $[j,j+1]$ where $j\in\mathbb{Z}$.
For every $k$ in $\mathbb{N}$, define a second function $f_k$ by
$$
f_k(x)=\frac{1}{2^k}f(2^k\,x),\,x\in\mathbb{R}.
$$
We then consider a third function $S_n$ defined by
$$
S_n(x)=\sum_{k=0}^nf_k(x),\,x\in\mathbb{R},\,n\in\mathbb{N}.
$$
It is known that for every fixed real $x$, $(S_n(x))_n$ is a convergent sequence and we denote by $S(x)$ its limit.
My first question is to show that:
$$
\forall x\in\mathbb{R},\,\forall n\in\mathbb{N},\,\left|S_n(x)-S(x)\right|\leq \frac{1}{2^n}??
$$
The second question is to prove that:
$$
\forall n\in\mathbb{N},\mbox{ the function }S_n \mbox{ is uniformly continuous over }\mathbb{R} ??
$$
From the last statment, one can deduce that the function $S$ is uniformly continuous over $\mathbb{R}$.
Let $x$ be a real and $n$ a positive integer. Put $$ x_n=\frac{\lfloor 2^nx \rfloor}{2^n},\,x_n^{\prime}=\frac{\lfloor 2^nx \rfloor+1}{2^n}. $$ Then, it is easy to show that $$ x_n\leq x<x_n^{\prime}\mbox{ and if }k>n \mbox{ then }f_k(x_n)=f_k(x_n^{\prime}). $$ Put $$ D_n=\frac{S(x_n^{\prime})-S(x_n)}{x_n^{\prime}-x_n} $$ The third and final question is to proove that there exists a sequence $(\varepsilon_n)_n\subset\{-1,1\}$ such that we have $D_n=\sum_{k=0}^n\varepsilon_k$?