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?
Here is a hint to get started: define $$f(x) = \left\{ \begin{array}{ll} 1 & x \text{ irrational}, \\ 0 & x \text{ rational}. \end{array} \right.$$
Then $x^2 f(x)$ is differentiable at $0$ and nowhere else, $x^2(x-1)^2f(x)$ is differentiable at $0$ and $1$ and nowhere else, $x^2(x-1)^2(x-1/2)^2 f(x)$ is differentiable at $0$ and $1$ and $1/2$ and nowhere else, etc.
Can you pass from a finite number of points of differentiability to a sequence?