Canonical P-adic Expansion of Rational is Eventually Periodic/Lemma 1

Theorem
Let $p$ be a prime number.

Let $b \in \Z_{> 0}$:
 * $b, p$ are coprime

Let $a \in \Z$.

Then:
 * $\forall n \in \N: \exists A_n, r_n \in \Z$ :
 * $(1) \quad \dfrac a b = A_n + p^n \dfrac {r_n} b$
 * $(2) \quad 0 \le A_n \le p^n - 1$
 * $(3) \quad \dfrac {a - \paren{p^n - 1} b } {p^n} \le r_n \le \dfrac a {p^n}$

Proof
Let $n \in \N$.

From Integer Coprime to all Factors is Coprime to Whole:
 * $b, p^n$ are coprime

From Integer Combination of Coprime Integers:
 * $\exists c_n, d_n \in \Z : c_n b + d_n p^n = 1$

Multiplying both sides by $a$:
 * $a = a c_n b + a d_n p^n$

Let $A_n$ be the least positive residue of $a c_n \pmod {p^n}$.

By definition of least positive residue:
 * $0 \le A_n \le p^n - 1$

Let $x_n$ be the multiple of $p^n$:
 * $a c_n = x_n p^n + A_n$

We have:

Let $r_n = b x_n + a d_n$.

Then:

We have:

The result follows.