Chapter 8 Some Base Results
Theorem 8.0.1.
Let \(b\gt 1\) be a positive integer. Then each \(n\in\mathbb{N}\) can be written uniquely in the form
where \(m\) is a nonnegative integer and \(a_i \in \{0,..., b-1\}\) for each \(i =0,..., m\) with \(a_m \neq 0.\)
Proof.
We successively apply the division algorithm, first dividing \(n\) by \(b\) to obtain
If \(q_0\) is zero, we are done and \(n = a_0.\) Otherwise continue this process, ending if every \(q_i = 0,\) to give a sequence of equalities,
where for each \(i, 0\leq a_i\leq b-1,\) and the quotient \(0\) is eventually obtained since
Substituting the equations back starting with the first and going to the last gives such a representation.
For uniqueness, suppose that we have two representations
where \(0\leq a_i, c_i\leq b-1\) and if where if needed we have padded the higher indices of one of the expansions with zeros. Now subtracting the expansions from each other, we have
If the two expansions are different, then there is a minimal integer \(j \hspace{2mm} (0\leq j\leq m)\) such that \(a_j-c_j\neq 0.\) Thus
so that
and \(b\vert (a_j-c_j).\) But this is possible only if \(a_j = c_j,\) a contradiction, so the expansion is unique.
We write the base-\(b\) expansion of an integer \(n\) (as in the above theorem) as
Theorem 8.0.2.
Let \(\xi\in [0, 1)\) be a real number, and let \(b\gt 1\) be a positive integer. Then \(\xi\) can be uniquely written as
where the integers \(c_i\in \{0,..., b-1\}\) for \(i\geq 1,\) with the restriction that for every positive integer \(N\) there is an integer \(n\geq N\) such that \(c_n\neq b-1.\)
Proof.
Let \(c_1:= \lfloor b\xi\rfloor,\) so that \(0\leq c_1\leq b-1\) and set
so \(\xi_1\in [0, 1)\) and
We recursively define for \(k\geq 2\)
so that \(0\leq c_k\leq b-1\) and \(\xi_k\in [0, 1).\) Then we have
Since \(\xi_n\in [0, 1),\) we have
and so
For uniqueness, assume that there are two different expansions
where \(0\leq c_i\leq b-1\) and \(0\leq d_i\leq b-1\) and for each integer \(N,\) there are \(n\) and \(m\) larger than \(N\) such that \(c_n \neq b-1\) and \(d_m \neq b-1.\) Suppose that \(k\) is the smallest index for which \(c_k \neq d_k.\) Without loss of generality we assume that \(c_k\gt d_k.\) Then
so that
But one easily sees that
This contradiction proves uniqueness and the theorem.
We write the base-\(b\) expansion of a real number \(\xi\in [0, 1)\) (as in the above theorem) as
Definition 8.0.3.
The base-\(b\) expansion \((0.c_1c_2c_3...)_b\) is said to terminate if there is a positive integer \(N\) such that \(c_n = 0\) for all \(n\geq N.\)
Theorem 8.0.4.
There real number \(\xi\in [0, 1)\) has a terminating base-\(b\) expansion if and only if \(\xi\in \mathbb{Q}\) and \(\xi = r/s,\) where \(0\leq r\lt s\) are integers and every prime factor of \(s\) divides \(b.\)
Proof.
Suppose that \(\xi\) has a terminating base-\(b\) expansion. Then
so that \(\xi\) is rational and can be written with a denominator only divisible by primes dividing \(b.\)
Now suppose that \(\xi\in [0, 1)\) and \(\xi = r/s\) where each prime dividing \(s\) divides \(b.\) Then there is an \(N\) such that \(s\vert b^N,\) so there is an integer \(a\) such that \(sa = b^N.\) Then
Now let \((a_ma_{m-1}\cdots a_1a_0)_b\) be the base-\(b\) expansion of \(ar.\) Then
which is a terminating base-\(b\) expansion.
Definition 8.0.5.
A base-\(b\) expansion \((.c_1c_2c_3...)_b\) is called periodic if there are \(N, k\in\mathbb{N}\) such that \(c_{n+k} = c_n\) for all \(n\geq \mathbb{N}.\) If \(N\gt 1,\) we call the part \(c_1c_2...c_{N-1}\) the pre-period and the part \(c_Nc_{N+1}c_{N+k-1}\) the period where here \(k\) is minimal with respect to this property.
Theorem 8.0.6.
Let \(b\gt 1\) be a positive integer. Then a periodic base-\(b\) expansion represents a rational number, and conversely, the base-\(b\) expansion of a rational number either terminates or is eventually periodic. Moreover, if \(\xi\in (0, 1)\cap \mathbb{Q}\) with \(\xi = r/s\) with \(\gcd(r, s) = 1,\) and \(s = TU\) where every prime factor of \(T\) divides \(b\) and \(\gcd(U, b) = 1,\) then the period length of the base-\(b\) expansion of \(\xi\) is the order of \(b\) modulo \(U,\) and the pre-period length is \(N,\) where \(N\) is the smallest positive integer such that \(T \vert b^N.\)
Proof.
For the first part of the theorem, suppose that \(\xi\) has an eventually periodic base-\(b\) expansion, so that
Since \(\xi\) is a sum of rational numbers it is rational.
Now suppose that \(\xi\in (0, 1), \xi = r/s\) where \(\gcd(r, s) = 1, s = TU\) where every prime dividing \(T\) divides \(b\) and \(\gcd(U, b) = 1.\) Let \(N\) be the smallest integer such that \(T\vert b^N.\)
Because \(T\vert b^N,\) there is a positive integer \(a\) such that \(aT = b^N.\) Thus
where \(A\) and \(C\) are integers with
and \(\gcd(C, U) = 1.\) Now since \(A\) is a positive integer, it has a base-\(b\) expansion, say \(A = (a_na_{n-1}...a_1a_0)_b.\)
If \(U = 1,\) then the base-\(b\) expansion of \(\xi\) terminates as shown previously. Otherwise, since \(\gcd(U, b) = 1,\) we let \(v\geq 1\) be the order of \(b\) modulo \(U.\) Then
for some integer \(t,\) since \(b^v\equiv 1\pmod{U}.\) But also, we have
where \((.c_1c_2...)_b\) is the base-\(b\) expansion of \(\dfrac{C}{U},\) so that for \(k\geq 1,\)
and \(\gamma_0 =\dfrac{C}{U}.\) From (8.0.2) we see that
Equating the fractional parts of (8.0.1) and (8.0.3), since \(\gamma_v\in [0, 1),\) we have
and so conclude that \(c_{k+v} = c_k\) for \(k\geq 1.\) Hence \(C/U = (.\overline{c_1c_2...c_v})_b\) has a periodic base-\(b\) expansion. Thus
so that dividing both sides by \(b^N\) gives
So in this case, the preperiod length is \(N\) and the period length is \(v.\)
To finish the proof we must show that one cannot regroup the base-\(b\) expansion of \(\xi\) so that either the preperiod or the period are shorter. To do this, suppose that
Because \(\xi = r/s\) with \(\gcd(r, s) = 1,\) we see that \(s\vert b^M(b^k-1).\) So \(T\vert b^M\) and \(U\vert b^k-1.\) Since \(N\) was minimal, \(M\geq N,\) and since \(v\) is the order of \(b\) modulo \(U, v\vert k\) (so \(v\leq k\)). This proves the theorem.
To write \(a/k\) in the base \(b,\) we use a sort of modified division algorithm; see Figure 8.0.7. We record here facts about the base-\(b\) algorithm, which we will need for our final results.

Lemma 8.0.8.
Suppose \(b, k\geq 2\) are coprime, and that \(r_j\) and \(q_j\) are defined by the base-\(b\) algorithm for \(a/k.\) Then \(\gcd(r_i, k) = 1.\)
Proof.
Suppose that \(p\vert k,\) and proceed by induction on \(i.\) Firstly, \(r_0 = a\) and by assumption \(\gcd(r_0, k) = \gcd(a, k) = 1.\) Now suppose that \(\gcd(r_i, k) = 1,\) so that also \(\gcd(r_ib, k) = 1.\) Then
since \(\gcd(b, k) = 1.\) Thus \(\gcd(r_{i+1}, k) = 1.\)
Also, we have that equivalent \(r_j\) give equal \(q_j.\)
Lemma 8.0.9.
Suppose \(b, k\geq 2\) are coprime, and that \(r_j\) and \(q_j\) are defined by the base-\(b\) algorithm for the reduced fraction \(a/k.\) We have \(r_i\equiv r_j\pmod{b}\) if and only if \(q_i=q_j.\)
Proof.
Suppose that \(r_i \equiv r_j \pmod{b}.\) By considering the difference between \(r_{i-1}b = q_ik + r_i\) and \(r_{j-1}b = q_jk + r_j\) modulo \(b,\) we see that \(b\vert (q_i-q_j)k,\) so that since \(\gcd(b, k) = 1,\) we have that \(b\vert (q_i-q_j).\) Since \(q_i, q_j \in \{0, 1,..., b-1\},\) we thus have that \(q_i = q_j.\)
Conversely, suppose that \(q_i = q_j.\) Here, again, we can consider the difference between the defining equations for \(q_i\) and \(q_j\) modulo \(b;\) this gives the desired result.
Indeed, the value of \(q_j\) is determined by the residue class of \(r_j\) modulo \(b\) and the value of \(k^{-1}\) modulo \(b.\)
Lemma 8.0.10.
Suppose \(b, k\geq 2\) are coprime, and that \(r_j\) and \(q_j\) are defined by the base-\(b\) algorithm for the reduced fraction \(a/k.\) We have \(r_i\equiv r_j\pmod{b}\) if and only if \(q_i\equiv -jk^{-1}\pmod{b},\) where \(q_i\in\{0,1,...,b-1\}.\)
Proof.
If \(r_i \equiv j\pmod{b},\) then the equation \(r_{i-1}b = q_ik + r_i\) gives \(q_ik \equiv -j \pmod{b},\) which in turn gives that \(q_i \equiv -jk^{-1}\pmod{b}.\) Since \(q_i\in [0, b-1]\) we are done with this direction of proof.
Conversely, suppose that \(q_i = -jk^{-1}\pmod{b}.\) Then surely, \(q_i\equiv -jk^{-1}\pmod{b}\) and so \(q_ik \equiv -j\pmod{b}.\) Thus, again using \(r_{i-1}b = q_ik + r_i,\) we have that \(r_i \equiv j \pmod{b}.\)
The following Lemma is a direct corollary of Lemma 8.0.10.
Lemma 8.0.11.
Suppose \(b, k\geq 2\) are coprime, and that \(r_j\) and \(q_j\) are defined by the base-\(b\) algorithm for the reduced fraction \(a/k.\) We have \(r_i\equiv 0\pmod{b}\) if and only if \(q_i=0.\)
Proof.
Apply Lemma 8.0.10 with \(j=0.\)
Theorem 8.0.6 tells us that the base \(b\) expansion of \(a/k\) is purely periodic (recall for us \(\gcd(b, k) = 1),\) and that the minimal period is \(\mathrm{ord}_kb,\) which divides \(\varphi(k),\) so that this also is a period. This result can be exploited using a result on primitive roots. Indeed, applying Theorem 7.2.3 gives the following result.
Theorem 8.0.12.
Let \(0\lt a/p^m \lt 1\) be a rational number in lowest terms and let \(b\geq 2\) be an integer that is a primitive root of \(p^2.\) Suppose that \((1/p^m)_b = .q_1q_2...q_n\) is given by the base \(b\) algorithm. Then
where \(\sigma\) is a cyclic shift on \(n\) letters.
Proof.
This is a direct consequence of the base-\(b\) algorithm.
As a consequence of the above lemmas we are able to provide the following characterisation of certain base-\(b\) expansions.
Theorem 8.0.13.
Let \(m\geq 1\) be an integer, \(p\) be an odd prime, \(b\geq 2\) be an integer coprime to \(p,\) and \(q_j\) and \(r_j\) be given by the base-\(b\) algorithm for the reduced fraction \(a/p^m.\) If \(b\) is a primitive root of \(p\) and \(p^2,\) then \(\mathrm{period}(a/p^m) = \varphi(p)\) and
Proof.
The fact that \(\mathrm{period}(a/p^m)_b = \varphi(p^m)\) follows directly from \(b\) being a primitive root of \(p\) and \(p^2,\) Theorem 7.2.3 and Theorem 8.0.6. This further implies that the \(\varphi(p^m)\) values of \(r_i\) given by the base-\(b\) algorithm for \(a/p^m\) are distinct. Applying Lemma 8.0.8 gives that
Also recall that
and that by Lemma 8.0.11, \(q_i = 0\) if and only if \(r_i \equiv 0\pmod{b}.\) Note that there are exactly
elements of \(\{i \leq p^m: \gcd(i, p) = 1\}\) which are divisible by \(b.\) Thus using the set equality (8.0.4), we have that there are exactly \(\lfloor p^m/b\rfloor-\lfloor p^{m-1}/b\rfloor\) elements of \(\{r_1, r_2,..., r_{\varphi(p^m)}\}\) divisible by \(b.\) Appealing to Lemma 8.0.11 we then have that there are \(\lfloor p^m/b\rfloor-\lfloor p^{m-1}/b\rfloor\) of \(q_1, q_2,..., q_{\varphi(p^m)}\) such that \(q_j=0.\)
Note that while we record the \(q_i = 0\) case because of its simplicity, the method can be applied to count any value of \(q_i\) that is desired by using the appropriate case of Lemma 8.0.10.