Cantor ternary function For $x \in [0,1]$, there is a ternary expansion
$$
x = \sum_{n=1}^{\infty} \frac{x_n}{3^n} \;, x_n \in \{0,1,2\} .
$$
Let $N_x=\infty$ if none of the $x_n$ are $1$, otherwise
let $N_x$ be the smallest value $n$ s.t. $x_n=1$.
Define the Cantor ternary function $f:[0,1] \longrightarrow \mathbb{R}$ by
$$
f(x)=\frac{1}{2^{N_x}} + \sum_{n=1}^{N_x-1} \frac{x_n}{2^{n+1}} \;.
$$
Show that $f$ is an increasing function.
My attempt:
Let
$$
x=\sum_{n=1}^{\infty}\frac{x_n}{3^n} < 
y=\sum_{n=1}^{\infty}\frac{y_n}{3^n} \; ,
$$
let $N=\min\{n \in \mathbb{N} \mid x_n \neq y_n \}$.
Step $1$: We claim $x_N < y_N$.
$$
\begin{aligned}
    0 > x-y &= \sum_{n=N}^{\infty} \frac{x_n-y_n}{3^n} \\
    &\geq \frac{x_N - y_N}{3^N} - 
    \sum_{n=N+1}^{\infty} \frac{2}{3^n} \\
    &= \frac{x_N - y_N}{3^N} - \frac{1}{3^N} \; ,
\end{aligned}
$$
so $x_N - y_N < 1$, since $x_N, y_N \in \{0,1,2\}$,
and $x_N \neq y_N$, then $x_N - y_N < 0$.
Step $2$: We claim
$$
\sum_{n=1}^{\infty} \frac{x_n-y_n}{2^{n+1}} \leq 0 \; .
$$
$$
\begin{aligned}
    \sum_{n=1}^{\infty} \frac{x_n-y_n}{2^{n+1}} &=
    \sum_{n=N}^{\infty} \frac{x_n-y_n}{2^{n+1}} \\
    &\leq \frac{-1}{2^{N+1}} + 
    \sum_{n=N+1}^{\infty} \frac{2}{2^{n+1}} \\
    &= 0 \; .
\end{aligned}
$$
Step $3$: We claim $f(x) \leq f(y)$.
Then I got stuck here.

Things become more clear if we write:$$f(x)=\sum_{n=1}^{N_x-1}2^{-n}\left(\frac12x_n\right)+\sum_{n=N_x+1}^{\infty}2^{-n}$$It indicates that it will be handsome to write $f(x)$ as a binary number and it is already clear at first sight that writing $x$ as a ternary number is handsome as well.
Doing so let us have a look at the following examples where $f$ is applied at ternary numbers at LHS and its value is written as a binary number on RHS.

*

*$0.20220\dots\mapsto0.10110\dots$

*$0.20221\dots\mapsto0.10110111\dots=0.10111000\dots$

*$0.20222\dots\mapsto0.10111\dots$
Increasing order on LHS evidently induces increasing order on RHS.
I hope this is enough for you. If not then at least it is inspiring.
