Question: write this in Java Exercise 1. A prime number, as you know, is a positive integer that has no factors other than 1 and itself.

write this in Java Exercise 1. A prime number, as you know,write this in Java

Exercise 1. A prime number, as you know, is a positive integer that has no factors other than 1 and itself. For example, the first six prime numbers are 2, 3, 5,7, 11, and 13. Therefore, if you are asked to find the 6th prime number, the answer is 13. In this exercise, you are to write a program to find the 11h, the 101s, 1001t, 10001st, 100001st, 1000001st and 10000001st prime numbers and determine how long your program takes to find each of those primes. The skeletal code for your program would look something similar to the one below. You can change the skeletal code if necessarv. You can also add other static methods if necessary //Finding the nth prime import java.util.Scanner; public class Prime public static void main (String[] args) //TODO public static long findNextPrime (long p) //TODO Enter your results in a table as shown below. Table 1: nth Prime Number nth prime number Execution time (millisec:s 1001 10001 100001 1000001 10000001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!