Problem 525. Mersenne Primes

Created by Drew Weymouth in Community

A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prime because 31 = 2^5 - 1 and both 31 and 5 are prime numbers.

Implement the function isMersenne(x) so that it returns true if x is a Mersenne prime and false otherwise. Your solution should work for all positive integer values of x less than 1,000,000,000 (one billion).

Solution Stats

37.72% Correct | 62.28% Incorrect
Last solution submitted on Feb 16, 2019

Problem Comments

Solution Comments

Recent Solvers110

Suggested Problems

More from this Author1

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!