A prime number has no factors besides 1 and itself do the


Question: A prime number has no factors besides 1 and itself. Do the following:

a. Write a program to determine if a positive integer N is prime. In terms of N, what is the worst-case running time of your program?

b. Let B equal the number of bits in the binary representation of N. What is the value of B?

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

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

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: A prime number has no factors besides 1 and itself do the
Reference No:- TGS02457574

Now Priced at $15 (50% Discount)

Recommended (92%)

Rated (4.4/5)