Proving that the function $f(x)=\sum_n\frac{1}{10^n}\{10^nx\}$ is everywhere continuous but nowhere differentiable. Theorem: The function $f(x)=\sum_{n=1}^{\infty}\frac{1}{10^n}\{10^nx\}$ is everywhere continuous but nowhere differentiable, where $\{.\} $ represents distance from nearest integer.
This theorem has been taken from chapter $23$ of Spivak's Calculus book.
By Weirstrauss M test, $f$ is uniformly continuous.
In the book, the theorem is proven by showing that the limit $L=\lim_{m\to \infty}\frac{f(a+h_m)-f(a)}{h_m}=\lim_{m\to \infty}\sum_{n=1}^{\infty}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}$ does not exist when $h_m\to 0$, where $a\in (0,1]$. Let $a=0.a_1a_2\cdots$ 
Let $h_m=10^{-m}$ if $a_m\ne 4,9$ and $h_m=-10^{-m}$ if $a_m=4,9$.$\tag{1}$ 
No. of terms in summation in the above limit $L$ is finite as if $n\ge m, 10^nh_m$ is integer and hence numerator of the summations becomes zero. So for $n\lt m$, $\{10^na\}=\text{integer}+0.a_{n+1}a_{n+2}\cdots a_m\cdots $ and
$10^n \{a+h_m\}=\text{integer}+0.a_{n+1}a_{n+2}\cdots (a_m\pm1)\cdots$ and this representation into decimals is correct as $h_m=-10^{-m}$ if $m=9$. 
**

Then, Spivak makes a statement that if $0.a_{n+1}a_{n+2}\cdots
 a_m\cdots \le 0.5$, then we also have $0.a_{n+1}a_{n+2}\cdots (a_m\pm
 1)\cdots \le 0.5$ as $h_m=-10^{-m}$ if $a_m=4$.

**
And I think that this is not true at all because in the special case $m=n+1$, if $a_m=5$ then clearly $0.a_m\le 0.5$ but $0.(a_m\pm 1)\le 0.5$ is not true! and hence condition on $h_m$ should be $h_m=-10^{-m}$ when $a_m=5,9$ and $h_m=10^{-m}$ when $a_m\ne 5,9$. Is my understanding correct?
Another doubt that I have is:
Is the following alternative way correct? 
Let's choose  $h_m=10^{-m}$ if $a_m\ne 9$ and $h_m=-10^{-m}$ if $a_m=9$. Then it's clear by writing decimal representation that, $\{10^n(a+h_m)\}-\{10^na\}=\pm 10^{n-m}$ and then $L=\lim_{m\to \infty}\frac{f(a+h_m)-f(a)}{h_m}=\lim_{m\to \infty}\sum_{n=1}^{\infty}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}=\lim_{m\to \infty}\sum_{n=1}^{m-1}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}\lim_{m\to \infty}\sum_{n=1}^{m-1}\pm 1=\lim_{m\to \infty}\pm (m-1)$,
which doesn't exist. Hence proved. 
Please help. Thanks.
 A: The idea of the construction is to keep preserved fractional parts on the same side of $\frac{1}{2}$, that is if $10^na-\lfloor 10^na\rfloor <\frac{1}{2}$, then $10^n(a+h_m)-[10^na]<\frac12$ and if $10^na-\lfloor 10^na\rfloor\geq\frac{1}{2}$, then $10^n(a+h_m)-\lfloor 10^na\rfloor\geq\frac12$
Try to convince yourself that

*

*If $a_m\notin\{4,9\}$, then for all $n=1,\ldots,m-1$,
$$\{10^n(a+10^{-m})\}-\{10^na\}=10^{n-m}\,(-1)^{\mathbb{1}_{a_n<5}(a)}$$
For $n\geq m$
$$\{10^n(a+10^{-m})\}=\{0.a_{m+1}a_{m+2}\ldots\}=\{10^na\}$$
so
$$\Delta_m:=\frac{1}{10^{-m}}\sum^\infty_{n=1}\frac{\{10^n(a+10^{-m})\}-\{10^na\}}{10^n}\equiv m\mod 2$$


*If $a_m\in\{4,9\}$, then for all $n=1,\ldots,m-1$,
$$\{10^n(a-10^{-m})\}-\{10^na\}=10^{n-m}\,(-1)^{1+\mathbb{1}_{a_n<5}(a)}$$
For $n\geq m$
$$\{10^n(a-10^{-m})\}=\{0.a_{m+1}a_{m+2}\ldots\}=\{10^na\}$$
so
$$\Delta_m:=-\frac{1}{10^{-m}}\sum^\infty_{n=1}\frac{\{10^n(a-10^{-m})\}-\{10^na\}}{10^n}\equiv m\mod 2$$

If you were to modify the construction and set $h_m=-10^{-m}$ if $a_m\in\{5,9\}$ and $h_m=10^{-m}$ otherwise then, for $a$ with $a_m=4$ you get
$$ \{10^{m-1}(a+10^{m})\}-\{10^{m-1}a\}=1-10^{-m} -2(0.4a_{m+1}\ldots)
$$
and so
$$\frac{1}{10^m}\sum^\infty_{n=1}\frac{\{10^n(a+10^{-m})\}-\{10^na\}}{10^n}\notin\mathbb{Z}$$
The genius of the construction is to keep all differential increments $\Delta_m$ as integers that vary on the parity of $m$.
