Quotient and Remainder to Number Base/General Result

Theorem
Let $n \in \Z: n > 0$ be an integer.

Let $n$ be expressed in base $b$:
 * $\displaystyle n = \sum_{j \mathop = 0}^m {r_j b^j}$

i.e.
 * $n = \left[{r_m r_{m-1} \ldots r_2 r_1 r_0}\right]_b$

Let $0 \le s \le m$.

Then:
 * $\left \lfloor {\dfrac n {b^s}} \right \rfloor = \left[{r_m r_{m-1} \ldots r_{s+1} r_s}\right]_b$
 * $\displaystyle n \,\bmod\, {b^s} = \sum_{j \mathop = 0}^{s-1} {r_j b^j} = \left[{r_{s-1} r_{s-2} \ldots r_1 r_0}\right]_b$

where:
 * $\left \lfloor {.} \right \rfloor$ denotes the floor function;
 * $n \,\bmod\, b$ denotes the modulo operation.