Discontinuous functions with the intermediate value property Show that any function $f$ which is not continuous on $[a,b]$, but satisfies the intermediate value property, assumes some value infinitely often.
Here $f$ has the intermediate value property if:
whenever $(c,d)$ is a subinterval of $[a,b]$, $f$ achieves every value between $f(c)$ and $f(d)$. 
I am close to the answer here. I know there exists an $\epsilon$ such that for all $\delta_n = {1\over n}$ we have an $x_n$ such that $|x_n-x_0|<1/n$ but $|f(x_n)-f(x_0)| \geq \epsilon$, where $f$ is not continuous at $x_0$. 
I'd like to be able to say that we can select these $x_n$ so that $(f(x_n))$ is a sequence of distinct elements, and then somehow proceed. How should I do this, and is this the correct way to go?
 A: Your approach is fine. For each $n$ you've got an $x_n$ in $(x_0-\frac1n,x_0+\frac1n)$ such that either $f(x_n)\ge f(x_0)+\epsilon$ or else $f(x_n)\le f(x_0)-\epsilon$. Now use the IVP [*] to get a $y_n$ in $(x_0-\frac1n,x_0+\frac1n)$ such that $f(y_n)$ is equal to $f(x_0)+\epsilon$ or $f(x_0)-\epsilon$. Conclude that at least one of those two values must be assumed infinitely often.
[*] Suppose, e.g., that $x_n\gt x_0$. The IVP applied to the interval $[x_0,x_n]$ says that, in that interval, $f$ assumes all values between $f(x_0)$ and $f(x_n)$. If $f(x_n)\ge f(x_0)+\epsilon$ then then $f(x_0)+\epsilon$ is one of those values; if $f(x_n)\le f(x_0)-\epsilon$ then . . .
A: Suppose that $f$ satisfies the conclusion of the IVT, i.e., $f$ is a Darboux function. If $f$ takes on each value a finite number of times, then $f$ is continuous.
We argue by contradiction. Suppose that $f$ is not continuous, so there is some $x_0$ and $\epsilon>0$ such that given any $\delta>0$ we have $0<|x-x_0|< \delta$ and $|f(x)-f(x_0)|> \epsilon$. Then either $|f(x)-f(x_0)|> \epsilon$ for infinitely many $x>x_0$ or else  for infinitely many $x<x_0$  (if were not the case, we can shrink the interval and $f$ would be continuous), say the first. Similarly $f(x)-f(x_0)>\epsilon$ or $f(x)-f(x_0)<-\epsilon$ for infinitely many $x$, say again the first. 
So there are infinitely many $x>x_0$ such that $f(x)-f(x_0)> \epsilon$. 
Let $a_1>x_0$ such that  $f(x_0)+\epsilon< f(a_1)$. Since $f$ is Darboux there is some $b_1 \in (x_0, a_1)$ such that $f(b_1)=f(x_0)+\epsilon$. Now let $a_2\in (x_0,b_1)$ so that   $f(x_0)+\epsilon< f(a_2)$, and again we thus have some $b_2\in (x_0,a_2)$ for which $f(b_2)=f(x_0)+\epsilon$. By induction we can have $f(b_n)=f(x_0)+\epsilon$ for all $n$, where $b_i\not= b_j$ if $i\not=j$. Hence $f$ takes on $f(x_0)+\epsilon$ a infinite number of times, a contradiction.
