I can see that this algorithm converts bases, however have questions on whats actually going on. The algorithm is presented, then questions follow.
Algorithm
To convert a number $X$ to base $B$.
$k = 1$
$X \bmod B = R_k$, $Q = \frac {X - R_k} B$
where $\bmod$ is defined: $q \in \mathbb{Z}, r = X - Bq, |r| < |B|$
$(Q = 0) \implies$ Goto #3
$(Q \ne 0) \implies (X = Q) \land (k = k + 1) \land $ Goto #1
Converted string is $R_n, ..., R_1$
What is happening mathematically that $R_k$, the remainders, correspond to the converted numbers digits? What significance is there to dividing by the new quotient $X = Q$ each iteration?
I have seen this algorithm a few times, however have yet to see a detailed mathematical explanation on why it works.
${a_ma_{m-1}a_{m-1}a_{m-3}....a_3a_2a_1a_0}_b = a_mb^m + a_{m-1}b^{m-1} + a_{m-2}b^{m-2}+a_{m-3}b^{m-3}+......+a_3b^3 + a_2b^2 + a_1b + a_0=$
$b(a_mb^{m-1} + a_{m-1}b^{m-2}+ a_{m-2}b^{m-3}+........ + a_3b^2 + a_2b + a_1) + a_0 =$
$b^(b(a_mb^{m-2} + a_{m-1}b^{m-3} + a_{m-3}b^{m-4}+.......+ a_3b + a_2) + a_1) + a_0 = $
$b(b(b(a_mb^{m-1} + a_{m-1}b^{m-4} + a_{m-3}b^{m-5}+.......+ a_3) + a_2) + a_1) + a_0 =$
$.....$
$b(b(....(a_mb^2 + a_{m-1}b + a_{m-2}) + a_{m-3} + ....... + a_3) + a_2) + a_1) + a_0=$
$b(b(b(....(a_mb + a_{m-1}) + a_{m-2}) + a_{m-3} + ....... + a_3) + a_2) + a_1) + a_0=$
So each of the $a_k$ digit is the result of taking a remainder when dividing by $b$.