Functions Which are non differentiable on a Given Set. I have recently read the famous Weierstrass Non differentiable function which is continuous everywhere but nowhere differentiable.   
But now my question is:  
Given a countable set $S (\subset \mathbb{R})$ , can we construct a function which is continuous everywhere but non differentiable only at points of S..?  
My Attempt:
If $S$ finite say, $S=\{c_1,c_2,...,c_n\}$ Then the following function is the desired one:$$f(x)=\sum_{i=1}^{n}|x-c_i|$$ 
But I cannot construct the function for a arbitrary Enumerable set $S.$   
Can we generalize the question for an arbitrary set $S$?
Please Help.
Thank you...!!
 A: The same construction can be generalized. Let $a_1,a_2,\dots$ be the elements of $S$.
Then the function $f(x)=\sum\limits_{n=1}^\infty \dfrac{|x-a_n|}{2^n \max(|a_n|,1)}$ is differentiable at all points except the points at $S$.
A: Yes. See this answer, on the kinds of sets where a function $f$ may fail to be differentiable. Such a set must be a $G_{\delta\sigma}$ set, meaning it must be an infinite, countable union of $G_{\delta}$ sets (which in turn are countable intersections of open sets).
Notice that every closed set is $G_{\delta}$ and in particular, every singleton is $G_{\delta}$:
$$\{p\}=\bigcap_{n\geq1}\left(p-\frac1n,p+\frac1n\right)$$
Hence, every countable set is $G_{\delta\sigma}$: $C=\cup_{n\in\mathbb{N}}\{c_n\}$.
The paper linked in the answer describes how one may construct continuous functions $f:\mathbb{R}\longrightarrow\mathbb{R}$ whose set of non-differentiability is a $G_1\cup G_2$, where $G_1$ is any $G_{\delta}$ and $G_2$ is a $G_{\delta\sigma}$ with measure zero. In particular, notice that every countable set is both $G_{\delta\sigma}$ and has measure zero, so every countable set may be written as some $G_1\cup G_2$.
