# Leigh.Samphier/Sandbox/Canonical P-adic Expansion of Rational is Eventually Periodic/Lemma 10

## Theorem

Let $p$ be a prime.

Let $b \in Z_{> 0}$ such that $b, p$ are coprime.

Let $\sequence{d_n}$ be a sequence of $p$-adic digits.

Let $\sequence{r_n}$ be a sequence of integers:

$(\text a) \quad \forall n \in \N: r_n = d_n b + p r_{n+1}$
$(\text b) \quad \exists n_0 \in \N : \forall n \ge n_0 : -b \le r_n \le 0$

Let:

$n, k \in \N : r_n = r_{n + k}$

Then:

$d_n = d_{n + k}$

## Proof

We have:

 $\ds d_n b + p r_{n + 1}$ $=$ $\ds r_n$ Hypothesis $\ds$ $=$ $\ds r_{n+k}$ Hypothesis $\ds$ $=$ $\ds d_{n+k} b + p r_{n + k + 1}$ Hypothesis $\ds \leadsto \ \$ $\ds p \paren{ r_{n + k + 1} - r_{n + 1} }$ $=$ $\ds \paren {d_n - d_{n + k} }b$ Re-arranging terms

As $b, p$ are coprime:

$p \nmid b$

From Euclid's Lemma:

$p \divides \paren {d_n - d_{n + k} }$

By definition of $p$-adic digits:

$d_n, d_{n + k} \in \set{0, 1, \ldots, p-1}$

Hence:

$d_n = d_{n+k}$

$\blacksquare$