Conway base 13 function

A real-valued function f on an interval [a, b] is said to have Intermediate Value Property (IVP) if for any number y lying between f(a) and f(b), there exists some $x \in [a, b]$ such that f(x) = y. Of course everyone learns that if f is continuous then it has IVP in his/her first course in analysis, which is known as the Intermediate Value Theorem. Now, one may ask if the converse is true: given f that satisfies IVP, must it be continuous? The answer is NO and an interesting counterexample is the Conway base 13 function.

Define the Conway base 13 function $f: \mathbb{R} \rightarrow \mathbb{R}$ as below. Let x be a real number. Consider the tredecimal (meaning “decimal” but with 13 symbols rather than 10) expansion of x, with symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, d, m, p (in the order of magnitude) representing the 13 tredigits (the counterpart of “digits” in tredecimal expansions), so that there is no recurring “p” at the end. If x ends with the pattern $s a_1 a_2 \ldots a_n d b_1 b_2 b_3 \ldots$ where s is either “p” or “m” and all $a_i, b_j \in \{0, 1, \ldots, 8, 9\}$, then we let $f(x) = \pm a_1 a_2 \ldots a_n \cdot b_1 b_2 b_3 \ldots$ where the sign is plus (resp. minus) if s is “p” (resp. “m”) , the dot represents the decimal point and the whole expression is interpreted as the decimal expansion of a real number. Otherwise, set f(x) = 0.

Theorem. Fix any a < b. For any real number c, there is some a < x < b such that f(x) = c.
Proof: Since a < b, their tredecimal expansions take the following forms:
$a = \alpha_1 \ldots \alpha_k A_1 A_2 \ldots$
$b = \alpha_1 \ldots \alpha_k B_1 B_2 \ldots$
with $A_1 < B_1$ (of course compared as tredigits). (Here there may be a tredecimal point appears somewhere in the expansion, but we do not show it in expansion and we assume to keep it in the same position when we construct new numbers from a and b.) Since by our convention of tredecimal expansion “p” cannot recur, we can take N such that $A_N \neq p$. Suppose the decimal expansion of c
$\pm \beta_1 \beta_2 \ldots \beta_n \cdot \gamma_1 \gamma_2 \ldots$.
Define x to be the real number with tredecimal expansion
$\alpha_1 \ldots \alpha_k A_1 \ldots A_{N - 1} p s \beta_1 \ldots \beta_n d \gamma_1 \gamma_2 \ldots$
where s is “p” (resp. “m”) if the sign of c is plus (resp. minus). By construction, we have a < x< b and f(x) = c.

Corollary. The Conway base 13 function (restricted to any closed and bounded interval) satisfies IVP but is discontinuous at any point on the real line.
Proof: It is easy to see that the Theorem directly implies IVP. For any point x on the real line, $\delta > 0$ and M > 0, by the Theorem we can find some $y \in (x - \delta, x + \delta)$ such that f(y) = M, hence f cannot be continuous at x.

Nice. I have a question: where have you used $A_N\neq p$?
There is in fact a typo in the definition of x. The use of $A_N \neq p$ is to ensure that x lies in the interval (a, b).