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

An integer is said to be prime if it is divisble by only 1 anditself. Example 2,

ID: 3609577 • Letter: A

Question

An integer is said to be prime if it is divisble by only 1 anditself. Example 2,3,5 are prime.
a) Write a method that determines whether a number is prime.
b) Use this method in an application that determines and displaysall the prime numbers less than 10,000. How many numbers up to10,000 do you have to test to ensure that you have found all theprimes?
c) Initially, you might think that n/2 is the upper limit for whichyou must test to see whether a number is prime or not, but you needonly go as high as the square root of n. Why? Rewrite the program,and run it both ways. Estimate the performance improvement.

Explanation / Answer

please rate - thanks part a import java.util.*; import java.io.*; public class prime {public static void main(String[] args) {int i,count=0; System.out.println("The prime numbers between 1 and 10,000are:"); for(i=1;i
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