Exercise 2 — Candidates WHO HAVE FOLLOWED the mathematics specialization coursePart A
We consider the following algorithm:
| Variables : | $a$ is a natural integer $b$ is a natural integer $c$ is a natural integer |
| Initialization : | Assign to $c$ the value 0 Request the value of $a$ Request the value of $b$ |
| Processing : | While $a > b$ Assign to $c$ the value $c + 1$ Assign to $a$ the value $a - b$ End of while |
| Output : | Display $c$ Display $a$ |
- Run this algorithm with $a = 13$ and $b = 4$ by indicating the values of the variables at each step.
- What does this algorithm allow us to calculate?
Part B
To each letter of the alphabet, we associate, using the table below, an integer between 0 and 25.
| A | B | C | D | E | F | G | H | I | J | K | L | M |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
We define an encoding process as follows: Step 1: To the letter we want to encode, we associate the corresponding number $m$ in the table. Step 2: We calculate the remainder of the Euclidean division of $9 m + 5$ by 26 and denote it $p$. Step 3 : To the number $p$, we associate the corresponding letter in the table.
- Encode the letter U.
- Modify the algorithm from Part A so that for a value of $m$ entered by the user, it displays the value of $p$, calculated using the above encoding process.
Part C
- Find an integer $x$ such that $9 x \equiv 1$ [26].
- Then prove the equivalence: $$9 m + 5 \equiv p \quad [ 26 ] \Longleftrightarrow m \equiv 3 p - 15$$
- Then decode the letter B.