Q:

Can you have a function $f \colon [0,1] \to \mathbb{R}$ that is only continuous on the Cantor set?

Let $C$ be the Cantor set. I know that it is possible to construct a function that is continuous on $[0,1]\setminus C$ and discontinuous on $C$ by just considering the characteristic function on $C.$ But can we have it be the other way around?
Because $C$ is closed, it is a $G_\delta$ set, and so it could be the set of points at which a function is continuous. I'm having a hard time figuring out if we can construct such a function, because $U = [0,1] \setminus C$ is dense, so I'm guessing we'd want the function to "jump around wildly" on $U$ if that makes sense?
Is it true that such a function can be created, and if so, how would we do so?

A:

Define $f(x)=d(x,C)$ if $x$ is rational, $f(x)=2d(x,C)$ if $x$ is irrational.

