Write a C++ function that inputs a positive integer and determines whether it is prime using trial division.
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
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.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images