Add algorithme d'euclide
This commit is contained in:
parent
c1401ef907
commit
4e93f9d9ac
1 changed files with 136 additions and 0 deletions
|
@ -66,4 +66,140 @@
|
|||
|
||||
\subsection{Algorithme d'Euclide}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabularx}{0.5\linewidth}{YYY}
|
||||
\toprule
|
||||
$a$ & $b$ & $r$ \\
|
||||
\toprule
|
||||
$a$ & $b$ & $r$ \\
|
||||
\midrule
|
||||
$b$ & $r$ & $r'$ \\
|
||||
\midrule
|
||||
$r$ & $r'$ & $r''$ \\
|
||||
\midrule
|
||||
$r'$ & $r''$ & $\ldots$ \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{center}
|
||||
|
||||
À chaque ligne, on calcule la division euclidienne de $a$ par $b$.
|
||||
Les restes calculés dans la colonne $r$ sont décroissants.
|
||||
Il suffit donc de s'arrêter quand on obtient 0.
|
||||
|
||||
Exemple~:
|
||||
|
||||
\begin{center}
|
||||
\begin{tabularx}{0.5\linewidth}{YYYl}
|
||||
\toprule
|
||||
$a$ & $b$ & $r$ & \\
|
||||
\toprule
|
||||
247 & 134 & 113 & \\
|
||||
\midrule
|
||||
134 & 113 & 21 & \\
|
||||
\midrule
|
||||
113 & 21 & 8 & \\
|
||||
\midrule
|
||||
21 & 8 & 5 & \\
|
||||
\midrule
|
||||
8 & 5 & 3 & \\
|
||||
\midrule
|
||||
5 & 3 & 2 & \\
|
||||
\midrule
|
||||
3 & 2 & $\boxed{1}$ & $\leftarrow$ le PGCD est là \\
|
||||
\midrule
|
||||
2 & 1 & 0 \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{center}
|
||||
|
||||
Le PGCD est le dernier reste, avant 0.
|
||||
|
||||
\subsection{Identité de Bezout}
|
||||
|
||||
\begin{equation*}
|
||||
\forall \; a, b \in \mathbb{N} : \exists\, (u,v) \in \mathbb{Z} \; / \; a \times u + b \times v = \mathrm{pgcd}(a,b)
|
||||
\end{equation*}
|
||||
|
||||
\begin{align*}
|
||||
\left.
|
||||
\begin{array}{ll}
|
||||
a &= 247 \\
|
||||
b &= 134 \\
|
||||
\end{array}
|
||||
\right\}
|
||||
\exists\, (u,v)\; /\; 247u + 134v = \mathrm{pgcd}(247,134) = 1
|
||||
\end{align*}
|
||||
|
||||
\subsection{Algorithme d'Euclide étendu}
|
||||
|
||||
\begin{enumerate}
|
||||
|
||||
\item Initialisation~: \\
|
||||
Se fait sur deux lignes.
|
||||
$u$ étant le coefficient de Bezout de $a$ et $v$ le coefficient de Bezout de $b$, on met leur cases à 1.
|
||||
|
||||
\item Séquence~: \\
|
||||
On calcule $q$ avec la division euclidienne.
|
||||
Puis, la ligne $i$ = ligne $(i-2) - q \times$ ligne $(i-1)$.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabularx}{0.5\linewidth}{YYYY}
|
||||
\toprule
|
||||
$r$ & $u$ & $v$ & $q$ \\
|
||||
\toprule
|
||||
$a$ & 1 & 0 & \\
|
||||
\midrule
|
||||
$b$ & 0 & 1 & $q$ \\
|
||||
\midrule
|
||||
$a-q\times b$ & $1 - q \times 0$ & $0 - q \times 1$ & \\
|
||||
\midrule
|
||||
$\vdots$ & & & \\
|
||||
$\downarrow$ & & & \\
|
||||
\midrule
|
||||
0 & & & \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{center}
|
||||
|
||||
Exemple~:
|
||||
|
||||
\begin{center}
|
||||
\begin{tabularx}{\linewidth}{YYYY}
|
||||
\toprule
|
||||
$r$ & $u$ & $v$ & $q$ \\
|
||||
\toprule
|
||||
247 & 1 & 0 & \\
|
||||
\midrule
|
||||
134 & 0 & 1 & 1 \\
|
||||
\midrule
|
||||
113 & $1 - (1 \times 0)$ & $0 - (1 \times 1)$ & 1 \\
|
||||
& = 1 & = -1 & \\
|
||||
\midrule
|
||||
21 & -1 & 2 & 5 \\
|
||||
\midrule
|
||||
8 & $ 1 - (5 \times -1)$ & $-1 - (5 \times -2)$ & 2 \\
|
||||
& $ = 6$ & $= -11$ & \\
|
||||
\midrule
|
||||
5 & -13 & 24 & 1 \\
|
||||
\midrule
|
||||
3 & 19 & -35 & 1 \\
|
||||
\midrule
|
||||
2 & -32 & 59 & 1 \\
|
||||
\midrule
|
||||
1 & 51 & -94 & 2 \\
|
||||
\bottomrule
|
||||
0 & -134 & 247 & \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{center}
|
||||
|
||||
On a donc~:
|
||||
\begin{align*}
|
||||
a \times u + b \times v &= 1 \\
|
||||
247 \times 51 + 134 \times (-94) &= 1 \\
|
||||
12597 - 12596 &= 1
|
||||
\end{align*}
|
||||
|
||||
\end{document}
|
||||
|
|
Loading…
Reference in a new issue