Problem

a. Write a program to determine if a positive integer, N, is prime.b. In terms of N, what...

a. Write a program to determine if a positive integer, N, is prime.


b. In terms of N, what is the worst-case running time of your program? (You should be able to do this in O().)


c. Let B equal the number of bits in the binary representation of N. What is the

value of B?


d. In terms of B, hat is the worst-case running time of your program?


e. Compare the running times to determine if a 20-bit number and a 40-bitnumber are prime.


f. Is it more reasonable to give the running time in terms of N or B? Why?

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 2