Is there any way to determine if there exists a continuous extension for a function I wanted to see if there was some way to determine if there exists a continuous extension for a function. Specifically, I am looking to know if there is a continuous extension for 
$f(x)=1/q $ for all $x=p/q$ where $p/q$ is a fraction in the rational numbers in lowest form. Could I use a fractal or some other iterative process to create this continuous extension?
 A: For your example, we run into trouble before extending anything anywhere: your function is not continuous on the rationals. We have
$$
   \lim_{n \to \infty} \frac{n-1}{n} = 1, \text{ but } \lim_{n \to \infty} f\left(\frac{n-1}{n}\right) = \lim_{n \to \infty} \frac1n = 0 \ne f(1) = 1.
$$
In general, if a function on the rationals can be continuously extended to the reals, there is only one way to do it. Say we have $f(p/q) = 1/q$ for all rational inputs, and we want to know $f(\sqrt2)$. Then take any sequence of rational numbers you like that converges to $\sqrt2$, such as $1, 1.4, 1.41, 1.414, 1.4142, \dots$. If the extension is continuous, then $f(1), f(1.4), f(1.41), f(1.414), f(1.4142), \dots$ must converge to $f(\sqrt2)$. So take the limit of the sequence $f(1), f(1.4), f(1.41), \dots$ and define that to be the value of $f(\sqrt2)$.
So then we must ask:


*

*Is this well-defined: do all sequences that converge to $\sqrt2$ give the same value when we do this? In this case, you can probably convince yourself that the answer is yes: you'll end up with $f(\sqrt2) = 0$ no matter which sequence you pick. (The same should be checked for every other irrational number.)

*Is the resulting function actually continuous? Here the answer is no, for pretty much the same reason that the function wasn't continuous on the rationals to begin with. (I'm not sure, but I believe that if we start with any function that's continuous on the rationals, and the limit procedure above is well-defined, then we'll get a function that's continous on the reals.)

