[step:Construct the digit sequences $(a_k)$ and $(b_k)$ by a greedy algorithm with carries]We construct the digits inductively. Define a sequence of **remainders** $r_0, r_1, r_2, \ldots$ by $r_0 := z$ and, at each stage $k \ge 1$, we select $s_k \in \{0, 2, 4\}$ and set $r_k := r_{k-1} - s_k / 3^k$, ensuring $r_k \in [0, 2 \cdot 3^{-k}]$.
At stage $k$, the remainder $r_{k-1}$ satisfies $0 \le r_{k-1} \le 2 \cdot 3^{-(k-1)}$ (verified below). We choose $s_k$ as follows:
- If $0 \le r_{k-1} \le \frac{2}{3^k}$, set $s_k := 0$. Then $r_k = r_{k-1} \in [0, 2 \cdot 3^{-k}]$.
- If $\frac{2}{3^k} < r_{k-1} \le \frac{4}{3^k}$, set $s_k := 2$. Then $r_k = r_{k-1} - \frac{2}{3^k} \in [0, 2 \cdot 3^{-k}]$.
- If $\frac{4}{3^k} < r_{k-1} \le \frac{6}{3^k} = \frac{2}{3^{k-1}}$, set $s_k := 4$. Then $r_k = r_{k-1} - \frac{4}{3^k} \in [0, 2 \cdot 3^{-k}]$.
These three cases cover the entire interval $[0, 2 \cdot 3^{-(k-1)}]$ (noting $6/3^k = 2/3^{k-1}$), so the construction always succeeds. The base case $r_0 = z \in [0, 2] = [0, 2 \cdot 3^0]$ holds, and at each step $r_k \in [0, 2 \cdot 3^{-k}]$, so the induction is valid.
After all stages, $r_k \to 0$ (since $0 \le r_k \le 2 \cdot 3^{-k}$), and by telescoping
\begin{align*}
z = r_0 = \sum_{k=1}^{n} \frac{s_k}{3^k} + r_n \to \sum_{k=1}^{\infty} \frac{s_k}{3^k}.
\end{align*}
Now decompose each $s_k \in \{0, 2, 4\}$:
\begin{align*}
s_k = 0 &\implies a_k := 0, \; b_k := 0, \\
s_k = 2 &\implies a_k := 0, \; b_k := 2, \\
s_k = 4 &\implies a_k := 2, \; b_k := 2.
\end{align*}
(The choice for $s_k = 2$ is not unique — $a_k = 2, b_k = 0$ also works — but any consistent choice suffices.)[/step]