Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedwrite 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

5. Discuss the role of the Web in career management.

Answered: 1 week ago