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.