2081 11

BIT303 · 2081 · 5 marks

Write Rabin Miller Algorithm for primality testing. Test whether 341 is prime or not using the algorithm.

Write Rabin Miller Algorithm for primality testing. Test whether 341 is prime or not using the algorithm. [5]

Information SecurityChapter 2: Cryptographic FoundationsPrimality testing algorithmsNumerical: Rabin Miller primality test
  • Number to test: $n = 341$ - Witness base (standard choice): $a = 2$ --- If $n$ is an odd prime, write $n - 1 = 2^s \cdot d$ with $d$ odd. Then for any witness $a$ coprime to $n$, either: $$a^d \equiv 1 \pmod{n} \quad\text{OR}\quad a^{2^r d} \equiv -1 \pmod{n} \text{ for some } 0 \le r < s$$ If ...