bac-s-maths 2014 Q4 (specialization)

bac-s-maths · France · caledonie Number Theory GCD, LCM, and Coprimality
We consider the following algorithm, where $A$ and $B$ are natural integers such that $A < B$:
Inputs:$A$ and $B$ natural integers such that $A < B$
Variables:$D$ is an integer
The input variables $A$ and $B$
Processing:Assign to $D$ the value of $B - A$
While $D > 0$
$B$ takes the value of $A$
$A$ takes the value of $D$
If $B > A$ Then
$D$ takes the value of $B - A$
Else
$D$ takes the value of $A - B$
End If
End While
Output:Display $A$

  1. We enter $A = 12$ and $B = 14$. By filling in the table given in the appendix, determine the value displayed by the algorithm.
  2. This algorithm calculates the value of the GCD of the numbers $A$ and $B$. By entering $A = 221$ and $B = 331$, the algorithm displays the value 1. a. Justify that there exist pairs $(x;y)$ of relative integers that are solutions of the equation $$(\mathrm{E}) \quad 221x - 331y = 1.$$ b. Verify that the pair $(3;2)$ is a solution of equation (E). Deduce the set of pairs $(x;y)$ of relative integers that are solutions of equation (E).
  3. We consider the sequences of natural integers $(u_{n})$ and $(v_{n})$ defined for every natural integer $n$ by $$u_{n} = 2 + 221n \text{ and } \begin{cases} v_{0} = 3 \\ v_{n+1} = v_{n} + 331 \end{cases}$$ a. Express $v_{n}$ as a function of the natural integer $n$. b. Determine all pairs of natural integers $(p;q)$ such that $$u_{p} = v_{q}, \quad 0 \leqslant p \leqslant 500 \quad \text{and} \quad 0 \leqslant q \leqslant 500.$$
We consider the following algorithm, where $A$ and $B$ are natural integers such that $A < B$:

\begin{center}
\begin{tabular}{|l|l|}
\hline
Inputs: & $A$ and $B$ natural integers such that $A < B$ \\
\hline
Variables: & $D$ is an integer \\
 & The input variables $A$ and $B$ \\
\hline
Processing: & Assign to $D$ the value of $B - A$ \\
 & While $D > 0$ \\
 & $B$ takes the value of $A$ \\
 & $A$ takes the value of $D$ \\
 & If $B > A$ Then \\
 & $D$ takes the value of $B - A$ \\
 & Else \\
 & $D$ takes the value of $A - B$ \\
 & End If \\
 & End While \\
\hline
Output: & Display $A$ \\
\hline
\end{tabular}
\end{center}

\begin{enumerate}
  \item We enter $A = 12$ and $B = 14$. By filling in the table given in the appendix, determine the value displayed by the algorithm.
  \item This algorithm calculates the value of the GCD of the numbers $A$ and $B$. By entering $A = 221$ and $B = 331$, the algorithm displays the value 1.\\
a. Justify that there exist pairs $(x;y)$ of relative integers that are solutions of the equation
$$(\mathrm{E}) \quad 221x - 331y = 1.$$
b. Verify that the pair $(3;2)$ is a solution of equation (E). Deduce the set of pairs $(x;y)$ of relative integers that are solutions of equation (E).
  \item We consider the sequences of natural integers $(u_{n})$ and $(v_{n})$ defined for every natural integer $n$ by
$$u_{n} = 2 + 221n \text{ and } \begin{cases} v_{0} = 3 \\ v_{n+1} = v_{n} + 331 \end{cases}$$
a. Express $v_{n}$ as a function of the natural integer $n$.\\
b. Determine all pairs of natural integers $(p;q)$ such that
$$u_{p} = v_{q}, \quad 0 \leqslant p \leqslant 500 \quad \text{and} \quad 0 \leqslant q \leqslant 500.$$
\end{enumerate}