Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Visual Studio C++ program to calculate and display all the Mersenne primes from 2 through 1,000,000. Your results should be as presented below,

Write a Visual Studio C++ program to calculate and display all the Mersenne primes from 2 through 1,000,000. Your results should be as presented below, under testing.

Testing:

Mersenne Primes by Colin Goble

n Mersenne Prime

== ==============

2 3

3 7

5 31

7 127

13 8191

17 131071

19 524287

Press q (or any other key) followed by 'Enter' to quit:

As an example, a prime number is represented when n = 5 in the formula 2n 1. 25 is 32, minus 1 is 31. The number 31 is a prime number. Your program should compute the value of 2n 1 for all integers starting at n = 1 and going until at least n = 19. If the result is a prime number, then it is a Mersenne Prime and it should be printed as output.

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 Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions