Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, can someone please provide me this code in Java, but while writing it can you make it so that it can compute the fastest

Hi, can someone please provide me this code in Java, but while writing it can you make it so that it can compute the fastest way possible? I have run it using the math.pow function, but that causes the program to just run for a very long time. If theres an alternative way that can allow the program to run quicker that would be great! Thank you! image text in transcribed
Write a program to find all the Mersenne Prime numbers between 3 and 263-1. A Mersenne Prime is a prime number that is of the form 2n-1. But not all values of this form are prime. Note that in order to test these numbers, you will have to use the "long" data type instead of "int" because the numbers become too large after 231-1. Your program should print all the powers of 2 minus 1 and state if the number is a Mersenne Prime or not. Measure the running time of your program using the System.currentTimeMillis() method to give you the current time in milliseconds at the beginning and end of your program. The difference between the start and end times is the running time

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago