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 get:
| 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\) |
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*}
We found the base \(2\) digits from the lowest power to the highest power. By convention, we write the digits in the opposite order, with the highest power of \(2\) on the left:
\begin{equation*}
13 = (1\cdot 2^3) + (1 \cdot 2^2) + (0 \cdot 2^1) + (1 \cdot 2^0).
\end{equation*}
This order makes the base \(2\) representation of \(13\) easy to read:
\begin{equation*}
13=1101_2
\end{equation*}


