TITLE: Does there exist a function $f: \mathbb{R} \to \mathbb{R}$ that is differentiable only at $0$ and at $\frac{1}{n}$, $n \in \mathbb{N}$?
QUESTION [10 upvotes]: How to determine the existence of the function $f: \mathbb{R} \rightarrow \mathbb{R}$, which is differentiable only at  $0$ and at $\frac{1}{n}$, $n \in \mathbb{N}$?
It's more than enough to give an example but I have some difficulties with it. 
Or even if it doesn't exist: how to find a hint that may be useful?

REPLY [4 votes]: Let $$g(x)=\cases {\exp\left(-\frac{1}{x(1-x)}\right) & if $0\le x \le 1$ , $x$ irrational \\
0 & elsewhere}$$
Then, in the interval $[0,1]$, $g(x)$ is only continuous and differentiable at $x=0$ and $x=1$ (and all the derivatives are zero).
The copy and paste the $y$-scaled/$x$-scaled-translated copies of it: $$ f(x)=\sum_{n=1}^\infty \frac{g(x \, n (n+1) + 1/n)}{n^2}$$