Let $\{r_n\}_{n\ge 1}$ be an enumeration of the rationals. Define $$F(x) := \sum_{r_n \le x} 2^{-n}$$ Following this answer, I'd like to show that $F$ is discontinuous at every rational, but continuous at every irrational.
Here's my shot at it:
Pick $x \in \Bbb R\setminus \Bbb Q$ and $\epsilon > 0$. We want $\delta > 0$ such that $|y-x| < \delta$ implies $|F(y) - F(x)| < \epsilon$. Suppose $y \in (x-\delta,x)$. The condition $|F(y) - F(x)| < \epsilon$ is satisfied if and only if $$\left|\sum_{r_n \le y} 2^{-n} - \sum_{r_n \le x} 2^{-n} \right| = \left|\sum_{y < r_n \le x} 2^{-n} \right| < \epsilon$$ I'm not sure what to do next. Could I have any hints, and intuition on why the said function behaves in such a peculiar manner?