castor28 said:
Exhibit a function from $\mathbb{R}$ to $\mathbb{R}$ such that the image of any open interval is the whole of $\mathbb{R}$. (In some sense, such a function is "as discontinuous as possible").
Laborious attempt at a solution:
[sp]Start with the equivalent problem over the rationals, namely to exhibit a function from $\mathbb{Q}$ to $\mathbb{Q}$ such that the image of any open interval is the whole of $\mathbb{Q}$.
For this, let $p_n\ (n\geqslant1)$ be the $n$th prime number. For each integer $s\geqslant2$, let $\theta(s)$ be the smallest $n$ for which $p_n$ divides $s$.
Let $\{r_n\}_{n\geqslant1}$ be an enumeration of the rational numbers.
For a rational number $q$, define $f(q) = 0$ if $q$ is an integer. If $q$ is not an integer then $q = \dfrac rs$ (where $r,s$ are coprime integers and $s>0$). In that case, define $f(q) = r_{\theta(s)}$.
Then $f:\mathbb{Q} \to \mathbb{Q}$ has the required property. In fact, if $J$ is an open interval and $n$ is a positive integer, choose $k$ so that $\dfrac1{p_n^k}$ is less than half the length of $J$. Then $J$ will contain a rational number of the form $q = \dfrac t{p_n^k}$ (where $t$ is an integer not divisible by $p_n$). It follows that $f(q) = r_n$. Thus $f(J)$ contains $r_n$ for every $n$.
Now, having completed the result for rational numbers, what about real numbers?
For that, choose an element $x_\alpha$ in each coset $x+ \mathbb{Q}$ in the additive group $\mathbb{R}$. Extend the above definition of the function $f$ from $\mathbb{Q}$ to $\mathbb{R}$ by $f(x_\alpha + q) = x_\alpha + f(q)$.
Each interval $J$ in $\mathbb{R}$ contains a representative $x_\alpha + q$ of the coset containing $x_\alpha$. The above argument for the rational case shows that $f(J)$ contains $x_\alpha + r_n$ for every $n$. In other words, $f(J)$ contains the whole coset. Since that holds for every $\alpha$, it follows that $f(J)$ is the whole of $\mathbb{R}$, as required.
Note: The Axiom of Choice is needed to choose the numbers $x_\alpha$. Is it possible to answer the question without using the Axiom of Choice?
[/sp]