Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function that determines whether anumber is prime. Use this function in

ID: 3613071 • Letter: W

Question

Write a function that determines whether anumber is prime.

Use this function in a program that determinesand prints all the prime numbers between 2 and 10,000. How many ofthese numbers do you really have to test before being sure that youhave found all the primes?

Initially, you might think that n/2 is the upperlimit for which you must test to see whether a number is prime, butyou need only go as high as the square root of n. Why? Rewrite theprogram, and run it both ways. Estimate the performanceimprovement.

Explanation / Answer

please rate - thanks #include #include #include using namespace std; int main() {int i,max=10000,j,factors; time_t t1=time(NULL); for(j=2;j
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote