bac-s-maths 2017 Q4B

bac-s-maths · France · liban 5 marks Number Theory Modular Arithmetic Computation
Exercise 4 (Candidates who have followed the specialization course)
A bank card number is of the form: $$a _ { 1 } a _ { 2 } a _ { 3 } a _ { 4 } a _ { 5 } a _ { 6 } a _ { 7 } a _ { 8 } a _ { 9 } a _ { 10 } a _ { 11 } a _ { 12 } a _ { 13 } a _ { 14 } a _ { 15 } c$$ where $a _ { 1 } , a _ { 2 } , \ldots , a _ { 15 }$ and $c$ are digits between 0 and 9. The first fifteen digits contain information about the card type, the bank, and the bank account number. $c$ is the validation key for the number. This digit is calculated from the other fifteen. The following algorithm allows validation of the conformity of a given card number.
Initialization: $I$ takes the value 0 $P$ takes the value 0 $R$ takes the value 0 Processing: For $k$ going from 0 to 7: $R$ takes the value of the remainder of the Euclidean division of $2 a _ { 2 k + 1 }$ by 9 $I$ takes the value $I + R$ End For For $k$ going from 1 to 7: $P$ takes the value $P + a _ { 2 k }$ End For $S$ takes the value $I + P + c$ Output: If $S$ is a multiple of 10
\textbf{Exercise 4 (Candidates who have followed the specialization course)}

A bank card number is of the form:
$$a _ { 1 } a _ { 2 } a _ { 3 } a _ { 4 } a _ { 5 } a _ { 6 } a _ { 7 } a _ { 8 } a _ { 9 } a _ { 10 } a _ { 11 } a _ { 12 } a _ { 13 } a _ { 14 } a _ { 15 } c$$
where $a _ { 1 } , a _ { 2 } , \ldots , a _ { 15 }$ and $c$ are digits between 0 and 9.
The first fifteen digits contain information about the card type, the bank, and the bank account number.
$c$ is the validation key for the number. This digit is calculated from the other fifteen.
The following algorithm allows validation of the conformity of a given card number.

Initialization: $I$ takes the value 0\\
$P$ takes the value 0\\
$R$ takes the value 0\\
Processing: For $k$ going from 0 to 7:\\
$R$ takes the value of the remainder of the Euclidean division of $2 a _ { 2 k + 1 }$ by 9\\
$I$ takes the value $I + R$\\
End For\\
For $k$ going from 1 to 7:\\
$P$ takes the value $P + a _ { 2 k }$\\
End For\\
$S$ takes the value $I + P + c$\\
Output: If $S$ is a multiple of 10