Find a function f:R->R (R the set of real numbers), such that

1. f has a discontinuity in every rational number, but is continous everywhere else, and

2. f is monotonic: x<y → f(x)<f(y)

Note: Textbooks frequently present examples of functions that meet only the first condition; requiring monotonicity makes for a slightly more challenging problem.

(In reply to

re: Oops... by Steve Herman)

I think there is a solution. I think it's going to be something like choosing a different base for the decimal (n-ary) expansion depending on the rational number chosen so that the expansion ends in 0's for that number. Then by using the expansion of the same number, base n+1, we'll get the same result as the w function. How do you do this in a way that preserves the monotonic requirement?

And then even worse, what then do we do with the irrationals? What base can we choose, and still satisfy the monotonic requirement? Or is there another way entirely to define this function for irrationals? JLo said something about the fact that the set of rationals is countable. But that's not helping me much...