Question: Part 1 . Problem 1 . Write a C + + function that inputs a positive integer and determines whether it is prime using trial
Part
Problem Write a C function that inputs a positive integer and determines whether it is prime
using trial division.
Use your function from Problem 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 Determine whether is prime for each of the primes not exceeding
Problem Find as many primes of the form where is a positive integer, as you can.
Note: Problems and are not related to each other. You need to develop a separate program for each
problem. Your programs should invoke your function from Problem
For Part submit your C programs, test results, and make a conclusion.
Part
Problem Read Section from the textbook. Give a short description of how encryptiondecryption
of text messages can be done using a shift cipher.
Problem
a Write a function that inputs a text message and a positive integer less than and outputs an
encrypted version of the message using the shift cipher with key
b Write a function that inputs a positive integer less than and a text message encrypted
using the shift cipher with key 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 submit your C program and test results. Make sure to test your program several
times.Part
Problem Write a C function that inputs a positive integer and determines whether it is prime
using trial division.
Use your function from Problem 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 Determine whether
is prime for each of the primes not exceeding
Problem Find as many primes of the form
where n is a positive integer, as you can.
Note: Problems and are not related to each other. You need to develop a separate program for each
problem. Your programs should invoke your function from Problem
For Part submit your C programs, test results, and make a conclusion.
Part
Problem Read Section from the textbook. Give a short description of how encryptiondecryption
of text messages can be done using a shift cipher.
Problem
a Write a C function that inputs a text message and a positive integer k less than 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 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 submit your C program and test results. Make sure to test your program several
times.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
