Example 12.26. Encode \(\mathtt{do}\) as a number.
Consider the word \(\mathtt{do}\text{.}\) We want to represent \(\mathtt{do}\) by a number in decimal representation in such a way that we can still recover the word.
The word \(\mathtt{do}\) consists of the two characters \(\mathtt{d}\) and \(\mathtt{o}\text{.}\) Using the encoding function \(C:\A\to\Z_{27}\) from Figure 8.1 we convert the two characters into numbers:
\begin{align*}
C(\mathtt{d})\amp=4\\
C(\mathtt{o})\amp=15
\end{align*}
Now we have represented \(\mathtt{do}\) by two numbers, but our goal is to represent it by one numbers. For each character the encoding function \(C\) yields a number in \(\Z_{27}\text{,}\) that is a number from \(0\) to \(26\text{.}\) This is also the range of the digits of the base \(27\) representation of a number. Considering \(4\) and \(15\) as base \(27\) digits as a number we get
\begin{equation*}
4\cdot 27^1+15\cdot 27^0=4\cdot 27+15\cdot 1=108+15=123.
\end{equation*}
Because we know how to determine the base \(27\) digits of a number from we can recover \(4\) and \(15\) and thus the word \(\mathtt{do}\) from the number \(123\text{,}\) see Example 12.27.