TITLE: A definition of Conway base-$13$ function
QUESTION [14 upvotes]: Can you give a definition of the Conway base-$13$ function better than the one actually presented on wikipedia, which isn't clear? Maybe with some examples?

REPLY [12 votes]: I understand why the Wikipedia article uses the notation it does, but I find it annoying. Here is a transliteration, with some elaboration.

Expand x ∈ (0,1) in base 13, using digits {0, 1, ... , 9, d, m, p} --- using the convention d = 10, m = 11, p = 12. N.B. for rational numbers whose most reduced expression a/b is such that b is a power of 13, there are two such expansions: a terminating expansion, and a non-terminating one ending in repeated p digits. In such a case, use the terminating expansion.
Let S ⊂ (0,1) be the set of reals whose expansion involves finitely many p, m, and d digits, such that the final d digit occurs after the final p digit and the final m digit. (We may require that there be at least one digit 0--9 between the final p or m digit and the final d digit, but this does not seem to be necessary.) Then, every x ∈ S has a base 13 expansion of the form
0.x1x2 ... xn [ p or m ] a1a2 ... ak [ d ] b1b2 ...
for some digits xj ∈ {0, ... , p} and where the digits aj and bj are limited to {0, ... , 9} for all j. The square brackets above are only intended for emphasis; and in particular the n+1st base-13 digit of x is the final occurance of either p or m in the expansion of x.
For x ∈ S, we define f(x) by transliterating the string format above. We ignore the digits x1 through xn , transliterate the p or m as a plus-sign or minus-sign, and the d as a decimal point. This yields a decimal expansion for a real number, either +a1a2 ... ak . b1b2 ... or −a1a2 ... ak . b1b2 ...according to whether the n+1st base-13 digit of x is a p or an m respectively. For x ∈ S, we set f(x) to this number; for x ∉ S, we set f(x) = 0.

Note: this function is not computable, as there is no way that you can determine in advance whether the base-13 expansion of x ∈ (0,1) has only finitely many occurances of any of the digits p, m, or d; even if you are provided with a number which is promised to have only finitely many, in general you cannot know when you have found the last one. However, if you are provided with a number x ∈ (0,1) for which you know the location of the final p, m, and d digits, you can compute f(x) very straightforwardly.

REPLY [3 votes]: The idea of the Conway base-13 number is to find a function that is not continuous, yet if f(a)<x<f(b), then there is some c between a and b with f(c)=x. This a counterexample to the converse of the intermediate value theorem.
The function is defined by encoding base-10 values in the tail (the digits left after skipping a finite number). We use +, -, . and the digits to represent an encoded number in the tail and require the encoded number to start with a + or -. In base 10, every number ending in an infinite number of 9s can be rewritten to end in an infinite number of 0s instead (ie. 0.999...=1.0). Similarly, we decide we will rewrite each Conway number ending in an infinite number of +, to ensure that each real number has a unique decimal representation.
Each number can have up to one base-10 encoded value, which is the result of applying Conway's Base 13 function if it exists. If no such encoding exists for x(ie. + occurring infinite times in the expansion), then we define f(x)=0.
We then show that for each a and b that we can find a c in between with an arbitrary encoded value. We first ensure the number being constructed is between a and b by copying enough digits from a and incrementing a digit that won't matter. This is easier because we have disallowed ending in an infinite number of +. We then concatenate the digits of the signed base-10 representation of the value we wish the function to have to those digits  we have already fixed.