Mersenne Primes - MATLAB Cody - MATLAB Central

Problem 525. Mersenne Primes

Difficulty:Rate

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

29.81% Correct | 70.19% Incorrect
Last Solution submitted on Feb 23, 2025

Problem Comments

Solution Comments

Show comments
MATLAB Without Borders: Connecting your projects with Python and other Open Source Tools.
On 27th February María Elena Gavilán Alfonso and I will be giving...
0
6

Problem Recent Solvers836

Suggested Problems

More from this Author1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page