Question: In C++, code lucas primality test This is the pseudocode: Input : n > 2, an odd integer to be tested for primality; k ,

In C++, code lucas primality test

This is the pseudocode:

Input: n > 2, an odd integer to be tested for primality; k, a parameter that determines the accuracy of the test Output: prime if n is prime, otherwise composite or possibly composite; determine the prime factors of n1. LOOP1: repeat k times: pick a randomly in the range [2, n  1] if {\displaystyle a^{n-1} ot \equiv 1{\pmod {n}}}In C++, code lucas primality test This is the pseudocode: Input: n then return composite else # {\displaystyle \color {Gray}{a^{n-1}\equiv 1{\pmod {n}}}}> 2, an odd integer to be tested for primality; k, a LOOP2: for all prime factors q of n1: if {\displaystyle a^{\frac {n-1}{q}} ot \equiv 1{\pmod {n}}}parameter that determines the accuracy of the test Output: prime if n then if we checked this equality for all prime factors of n1 then return prime else continue LOOP2 else # {\displaystyle \color {Gray}{a^{\frac {n-1}{q}}\equiv 1{\pmod {n}}}}is prime, otherwise composite or possibly composite; determine the prime factors ofcontinue LOOP1 return possibly composite.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!