Originally Posted by

**Opalg** The answer is No, but I found it quite tricky to construct a counterexample.

Start with something easier. Define a sequence of functions $\displaystyle f_n(x)$ on the unit interval as follows: on the interval from 0 to $\displaystyle 2^{-n-1}$, $\displaystyle f_n(x)$ increases linearly from 0 to 1; on the interval from $\displaystyle 2^{-n-1}$ to $\displaystyle 2^{-n}$, $\displaystyle f_n(x)$ decreases linearly from 1 to 0; and on the remainder of the interval, $\displaystyle f_n(x) = 0$. Then it is well known that $\displaystyle f_n(x)\to0$ pointwise but not uniformly on the unit interval. In fact, if the binary expansion of x has a 1 in any of the first k places, then $\displaystyle f_n(x) = 0$ whenever $\displaystyle n\geqslant k$.

Now extend $\displaystyle f_n(x)$ by periodicity to a function on the whole real line, with period 1. Thus $\displaystyle f_n(x)$ is a function with a narrow spike, of height 1, to the right of each integer point.

Next, define a sequence of functions $\displaystyle g_n(x)$ by $\displaystyle g_n(x) = \sum_{k=1}^n 2^{-k}f_n(2^kx)$. Then $\displaystyle g_n(x)$ is a continuous function. If $\displaystyle n\geqslant k$ then $\displaystyle g_n(x) \geqslant 2^{-k}f_n(2^kx)$. But $\displaystyle 2^{-k}f_n(2^kx)$ attains the value $\displaystyle 2^{-k}$ in every interval of length $\displaystyle 2^{-k}$. Therefore $\displaystyle \max\{g_n(x):x\in J\}\geqslant 2^{-k}$ for all $\displaystyle n\geqslant k$ in any interval $\displaystyle J$ of length $\displaystyle 2^{-k}$. Therefore $\displaystyle g_n(x)$ does not tend uniformly to 0 in any interval.

However, $\displaystyle g_n(x)\to0$ pointwise. To see that, we have to consider two separate cases.

__Case 1:__ x has only finitely many 1's in its binary expansion. Suppose that the last 1 occurs in the r'th place in the binary expansion, and let $\displaystyle n>r$. Then for $\displaystyle k<r$, $\displaystyle 2^kx$ has a 1 somewhere in the first n places of its binary expansion, and so $\displaystyle f_n(2^kx)=0$. And for $\displaystyle k\geqslant r$, $\displaystyle 2^kx$ is an integer, so again $\displaystyle f_n(2^kx)=0$. Thus $\displaystyle g_n(x) = 0$ for all $\displaystyle n> r$.

__ Case 2:__ x has infinitely many 1's in its binary expansion. Then given $\displaystyle \varepsilon>0$, there exists $\displaystyle r$ with $\displaystyle 2^{-r} < \varepsilon/2$ such that x has a 1 in its $\displaystyle r$'th binary place. If $\displaystyle n>r$ then $\displaystyle g_n(x) = \sum_{k=1}^r 2^{-k}f_n(2^kx) + \sum_{k=r+1}^n 2^{-k}f_n(2^kx)$. But the first of those sums is 0, and the second is less than $\displaystyle \varepsilon$. Therefore $\displaystyle g_n(x) < \varepsilon$.

So in either of the two cases, $\displaystyle g_n(x)\to0$ as $\displaystyle n\to\infty$.