Problem

Write a program to check if a number n is composite or probably prime as follows. Choose 1...

Write a program to check if a number n is composite or probably prime as follows. Choose 10 random numbers a1, a2, … , a10 between 2 and n 1 and compute mod n for each ai. If   (mod n) for any ai, return the message “n is composite.” If   (mod n) for all the ai’s, return the message “n is probably prime.”

Incorporate this program into your factorization program as a way to check when a large number is prime.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 16