% John David Stone % Department of Mathematics and Computer Science % Grinnell College % stone@cs.grinnell.edu % created June 19, 2002 % last revised June 19, 2002 \documentclass[11pt]{article} \begin{document} \textbf{Algorithm E} (\textit{Euclid's algorithm}). Given two positive integers $m$ and $n$, find their \textit{greatest common divisor}, that is, the largest positive integer that evenly divides both $m$ and $n$. \begin{itemize} \item[\textbf E1.] [Find remainder.] Divide $m$ by $n$ and let $r$ be the remainder. (We will have $0 \le r < n$.) \item[\textbf E2.] [Is it zero?] If $r = 0$, the algorithm terminates; $n$ is the answer. \item[\textbf E3.] [Reduce.] Set $m \leftarrow n$, $n \leftarrow r$, and go back to step 1. \quad \rule[-0.5 ex]{0.5 ex}{1.75 ex} \end{itemize} \end{document}