Question: Part 1 . Problem 1 . Write a C + + function that inputs a positive integer and determines whether it is prime using trial

Part 1.
Problem 1. Write a C++ function that inputs a positive integer and determines whether it is prime
using trial division.
Use your function from Problem 1 to write a C++ program for solving each of the following
computational problems. For each problem, find the running time function of the algorithm you are
using to write the corresponding program.
Problem 2. Determine whether 2p-1 is prime for each of the primes not exceeding 100.
Problem 3. Find as many primes of the form n2+1, where n is a positive integer, as you can.
Note: Problems 2 and 3 are not related to each other. You need to develop a separate program for each
problem. Your programs should invoke your function from Problem 1.
For Part 1, submit your C++ programs, test results, and make a conclusion.
Part 2.
Problem 4. Read Section 4.6 from the textbook. Give a short description of how encryption/decryption
of text messages can be done using a shift cipher.
Problem 5.
a) Write a C++ function that inputs a text message and a positive integer k less than 26 and outputs an
encrypted version of the message using the shift cipher with key k.
b) Write a C++ function that inputs a positive integer k less than 26 and a text message encrypted
using the shift cipher with key k and outputs a decrypted version of the message.
c) Write a C++ program to test your functions from parts a) and b).
Note: While working on this problem, assume that each text message consists of capital letters and
spaces only.
For Problem 5, submit your C++ program and test results. Make sure to test your program several
times.Part 1.
Problem 1. Write a C++ function that inputs a positive integer and determines whether it is prime
using trial division.
Use your function from Problem 1 to write a C++ program for solving each of the following
computational problems. For each problem, find the running time function of the algorithm you are
using to write the corresponding program.
Problem 2. Determine whether 2
1 is prime for each of the primes not exceeding 100.
Problem 3. Find as many primes of the form
2+1, where n is a positive integer, as you can.
Note: Problems 2 and 3 are not related to each other. You need to develop a separate program for each
problem. Your programs should invoke your function from Problem 1.
For Part 1, submit your C++ programs, test results, and make a conclusion.
Part 2.
Problem 4. Read Section 4.6 from the textbook. Give a short description of how encryption/decryption
of text messages can be done using a shift cipher.
Problem 5.
a) Write a C++ function that inputs a text message and a positive integer k less than 26 and outputs an
encrypted version of the message using the shift cipher with key k.
b) Write a C++ function that inputs a positive integer k less than 26 and a text message encrypted
using the shift cipher with key k and outputs a decrypted version of the message.
c) Write a C++ program to test your functions from parts a) and b).
Note: While working on this problem, assume that each text message consists of capital letters and
spaces only.
For Problem 5, submit your C++ program and test results. Make sure to test your program several
times.
Part 1 . Problem 1 . Write a C + + function that

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 Accounting Questions!