\begin{definition}[Definition:Classical Algorithm/Subtraction]
Let $u = \sqbrk {u_{n - 1} u_{n - 2} \dotsm u_1 u_0}_b$ and $v = \sqbrk {v_{n - 1} v_{n - 2} \dotsm v_1 v_0}_b$ be $n$-digit integers.
The '''classical subtraction algorithm''' forms their $n$-digit difference $u - v$:
:$w = \sqbrk {w_n w_{n - 1} \dotsm w_1 w_0}_b$
where $w_n$ is either $0$ or $1$.
The steps are:
:$(\text S 1): \quad$ Set $j = 0$, $k = 0$.
::::$j$ is used to run through all the digit positions
::::$k$ keeps track of the carry digit between each step.
:$(\text S 2): \quad$ Calculate digit $j$:
::::Calculate $\begin {cases} d = \paren {u_j + v_j - k} \pmod b \\ c = \floor {\dfrac {u_j - v_j + k} b} \end {cases}$ using the primitive subtraction.
::::Set $w_j$ to $d$.
::::Set $k$ to $c$.
:$(\text S 3): \quad$ Add $1$ to $j$, using conventional integer addition.
::::If $j < n$, return to $(\text S 2)$.
::::Otherwise exit.
\end{definition}