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

Chapter 2, Problem 2.20

(choose chapter or problem)

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 shouldbe able to do this in O(N).)c. Let B equal the number of bits in the binary representation of N. What is thevalue of B?d. In terms of B, what is the worst-case running time of your program?e. Compare the running times to determine if a 20-bit number and a 40-bit numberare prime.f. Is it more reasonable to give the running time in terms of N or B? Why?

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back