Differentiability of a series with rational number sequence I am doing some old question set, and I encounter the following problem:
Put all the rational numbers in a sequence $\{ Q_n\} $. Define the function $\ f(x)=\sum_{n=1}^\infty \frac{|x-Q_n|}{5^n}$.
(a) Show that $f$ is continous on $\mathbb{R}$.
(b) Show that $f$ is differentiable at $x$ iff $x$ is an irrational number.
Using triangle inequality I am able to solve (a), but I get stuck at (b). Can anyone give me some hints?

Let $a\in\Bbb R$. If $a$ is irrational, then $|x-Q_n|$ is differentiable at $a$ for all $n$ with derivative $\pm1$. This implies that the series can be differentiated term by term.
On the other hand, if $a$ is rational, then $a=Q_N$ for some $N\in\Bbb N$, and $|x-Q_n|$ is not differentiable at $a$, while $|x-Q_n|$ is differentiable at $a$ for all $n\ne N$ with derivative $\pm1$. 
