We find the base \(2\) representation of \(a=13\text{.}\) Instead of writing \(q_0\text{,}\) \(q_1\text{,}\) and so on we reuse the variable \(a\) So that when we add a new row the number in the \(a\) column is the number in the \(a \fdiv 2\) column from the previous row. We stop when the number in the \(a \fdiv 2\) column becomes \(0\text{.}\)
| Step | Power of \(2\) | \(a\) | \(a \fmod 2\) | \(a \fdiv 2\) |
|---|---|---|---|---|
| \(0\) | \(2^0\) | \(13\) |
Filling in the last two columns we obtain:
| Step | Power of \(2\) | \(a\) | \(a \fmod 2\) | \(a \fdiv 2\) |
|---|---|---|---|---|
| \(0\) | \(2^0\) | \(13\) | \(r_0=1\) | \(6\) |
| Step | Power of \(2\) | \(a\) | \(a \fmod 2\) | \(a \fdiv 2\) |
|---|---|---|---|---|
| \(0\) | \(2^0\) | \(13\) | \(r_0=1\) | \(6\) |
| \(1\) | \(2^1\) | \(6\) | \(r_1=0\) | \(3\) |
Continuing this process, we fill out the rest of the table. We stop when \(a \fdiv 2 = 0\text{.}\)
| Step | Power of \(2\) | \(a\) | \(a\fmod 2\) | \(a \fdiv 2\) |
|---|---|---|---|---|
| \(0\) | \(2^0\) | \(13\) | \(r_0=1\) | \(6\) |
| \(1\) | \(2^1\) | \(6\) | \(r_1=0\) | \(3\) |
| \(2\) | \(2^2\) | \(3\) | \(r_2=1\) | \(1\) |
| \(3\) | \(2^3\) | \(1\) | \(r_3=1\) | \(0\) |
Thus the base \(2\) expansion of \(13\) is
\begin{equation*}
13 = (1\cdot 2^0) + (0 \cdot 2^1) + (1 \cdot 2^2) + (1 \cdot 2^3).
\end{equation*}
Although we computed the base \(2\) digits in this order, it is customary to write the last significant digit, that is the digit with the lowest power of \(2\) last:
\begin{equation*}
13 = (1\cdot 2^2) + (1 \cdot 2^2) + (0 \cdot 2^1) + (1 \cdot 2^0).
\end{equation*}
This ordering also makes it easy to read off the base \(2\) representation of \(13\text{:}\)
\begin{equation*}
13=1101_2
\end{equation*}


