Theorem 5.2.1.1.
Let \(b\in\NN-\{1\}\) and \(a\in\NN\cup\{0\}\text{.}\) Then there are \(n\in\NN\cup\{0\}\) and \(a_i\in\ZZ_b\) where \(0\le i\le n\) such that
\begin{equation*}
a=\sum_{i=0}^n a_i\cdot b^i.
\end{equation*}
def base_b_expansion(b,a):
"""
The list L of coefficients of the base b
expansion of a, such that b = L[0]+L[1]*b+L[2]+b^2+...
"""
L = [ ]
while a != 0:
q,r = divmod(a,b)
L.append(r)
a = q
return L
2, 3, 4, β¦, to change the base. Click on +1, β¦, +10, β¦ to increment both the representation of the number in the chosen base and base 10. Click on 0 to reset to \(0\text{.}\)
https://xkcd.com/953/) If you get an 11/100 on a CS test, but you claim it should be counted as a `Cβ, theyβll probably decide you deserve the upgrade.