Let $f:\mathbb{R}\to \mathbb{R}$ is a function with $f(\mathbb{R})\subseteq \mathbb{Q}$ such that for every Cauchy sequence of rational numbers $(a_i)$, $\lim_{i\to \infty}f(a_i)$ exists. Prove that $f$ is constant.
If I can prove that $f$ is continuous then I am able to do this problem, I am unable to prove the function is continuous.
My try:
Take $x\in \mathbb{R}$. Then there exists a sequence of rational nmber converging to that $x$, say $(x_n)$. After that can't think of what to do next.