2023-12-09 18:17:22 -08:00

65 lines
1.6 KiB
TeX
Executable File

\section{The Euclidean Algorithm}
\definition{}
The \textit{greatest common divisor} of $a$ and $b$ is the greatest integer that divides both $a$ and $b$. \par
We denote this number with $\gcd(a, b)$. For example, $\gcd(45, 60) = 15$.
\problem{}
Find $\gcd(20, 14)$ by hand.
\begin{solution}
$\gcd(20, 14) = 2$
\end{solution}
\vfill
\theorem{The Division Algorithm}<divalgo>
Given two integers $a, b$, we can find two integers $q, r$, where $0 \leq r < b$ and $a = qb + r$. \par
In other words, we can divide $a$ by $b$ to get $q$ remainder $r$.
\vspace{2mm}
For example, take $14 \div 3$. We can re-write this as $3 \times 4 + 2$. \par
Here, $a$ and $b$ are $14$ and $3$, $q = 4$ and $r = 2$.
\theorem{}<gcd_abc>
For any integers $a, b, c$, \par
$\gcd(ac + b, a) = \gcd(a, b)$
\problem{}
Compute $\gcd(668, 6)$. \hint{$668 = 111 \times 6 + 2$}
Then, compute $\gcd(3 \times 668 + 6, 668)$.
\vfill
\problem{The Euclidean Algorithm}
Using the two theorems above, detail an algorithm for finding $\gcd(a, b)$. \par
Then, compute $\gcd(1610, 207)$ by hand. \par
\begin{solution}
Using \ref{gcd_abc} and the division algorithm,
% Minipage prevents column breaks inside body
\begin{multicols}{2}
\begin{minipage}{\columnwidth}
$\gcd(1610, 207)$ \par
$= \gcd(207, 161)$ \par
$= \gcd(161, 46)$ \par
$= \gcd(46, 23)$ \par
$= \gcd(23, 0) = 23$ \par
\end{minipage}
\columnbreak
\begin{minipage}{\columnwidth}
$1610 = 207 \times 7 + 161$ \par
$207 = 161 \times 1 + 46$ \par
$161 = 46 \times 3 + 23$ \par
$46 = 23 \times 2 + 0$ \par
\end{minipage}
\end{multicols}
\end{solution}
\vfill
\pagebreak