# Continuity of function $f(x)$ at irrational numbers.

Let $$\{q_k:\ k \in \mathbb N^+\}$$ be an enumeration of the rational numbers in $$[0,\ 1)$$ and let $$(a_k)$$ be a sequence of strictly positive real numbers such that

$$\sum_{k=1}^\infty a_k = 1$$

Denote $$S(x) = \{k \in \mathbb N^+:\ q_k \in [0,\ x)\}$$ i.e. indices of rational numbers in $$[0,\ x)$$ and define $$f:[0,\ 1] \rightarrow \mathbb R$$ by

$$f(x) = \begin{cases} \sum_{k \in S(x)} a_k & (x > 0) \\ 0 & (x = 0) \end{cases}$$

I know that $$f(x)$$ is discontinuous at every positive rational number. I speculate that $$f(x)$$ is continuous at irrational numbers, but I have no idea how to prove or disprove it.

You can find an answer in this thread. Although the situation is more special, because there $$a_k = 2^{-k}$$ is chosen, the proof doesn't change. Let $$x \in \mathbb{R}$$ be irrational, and let $$N \in \mathbb{N}$$ with $$\sum_{k=N1}^\infty a_n < \varepsilon/2$$. Now define $$\delta:= \min_{i=1,\ldots,N}|q_i-x|.$$ For any $$|y-x| < \delta$$ we have $$q_k \in [0,x)$$ if and only if $$q_k \in [0,y)$$ for all $$k=1,\ldots,N$$. Thus $$S(x) \cap [1,N] = S(y) \cap [1,N]$$ and therefore $$|f(x)-f(y)| \le 2 \sum_{k=N+1}^\infty a_k<\varepsilon.$$