Question
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. 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.
Submit your C++ programs, test results, and make a conclusion.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started