# Continuous only on the Rationals?

Calculus Level 4

Does there exist a function $f: \mathbb{R} \rightarrow \mathbb{R}$ that is continuous on exactly the rational numbers?

Note: The following function $f: \mathbb{R} \rightarrow \mathbb{R}$ is discontinuous on exactly the rational numbers:

$\hspace{1.0cm}$ Index all the rational numbers using the bijection function $a: \mathbb{N} \rightarrow \mathbb{Q}$.
$\hspace{1.0cm}$ Define $f: \mathbb{R} \rightarrow \mathbb{R}$ as $\displaystyle f(x) = \sum_{ a(n) < x } 2^{-n }.$

×