Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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, 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 10000001Step 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