TITLE: An explicit example of a differentiable function taking rational values at rational points but whose derivative is irrational at rational points
QUESTION [6 upvotes]: Construct an example of a differentiable function such that
$$
\forall r \in {\Bbb Q}\quad f(r)
 \in {\Bbb Q}\text{ but } f'(r) \notin {\Bbb Q}
$$
this example is not trivial, in a paper they prove the existence, but they don't give an explicit example, but they said that other paper as an explicit example of that, but i could not find it. 
EDITED: This is the paper:
Walter Rudin, Restrictions on the Values of Derivatives, The American Mathematical
Monthly, Vol. 84, No. 9 (1977), pp. 722-723, MR480908.

REPLY [10 votes]: The problem posed is available here, but here it is in its entirety:

Here's a link to the paper you're looking for:
F. D. Hammer and William Knight, Solution to problem 5955,
The American Mathematical Monthly
Vol. 82, No. 4 (Apr., 1975), pp. 415-416. MR1537708.

The solution given in that paper is very simple and elegant: 
Let $\tilde{g}: \left[-\frac{1}{2},\frac{1}{2}\right] \to \mathbb{R}$ be the function $\tilde{g}(x) = x(1-4x^2)$. Its $1$-periodic extension $g$ to all of $\mathbb{R}$ is a $C^1$-function that is zero at the integers and whose derivative at the integers is $1$.
Now let $$f(x) = \sum_{n=0}^{\infty} \frac{g(n!x)}{(n!)^2}.$$
It is straightforward to check that $f\in C^1$ [let $f_k \in C^1$ be the $k$th partial sum of the series. Then $f_k \to f$ pointwise and $f_{k}^\prime$ is uniformly Cauchy, so $f \in C^1$]. Now notice that for rational $x$ only finitely many summands of $f$ are non-zero, hence $f(\mathbb{Q}) \subset \mathbb{Q}$. On the other hand, for rational $x$ we have $$f'(x) - e = f'(x) - \sum_{n=1}^{\infty} \frac{1}{n!} = \text{finitely many rational terms}  \in \mathbb{Q},$$
so $f'(x) \notin \mathbb{Q}$, as desired.
(Thanks to robjohn for pointing out a mistake in the previous version of this answer)