Menu
Question Index
...

Write a program to find whether the given number is Mersenne Prime.
NOTE: Mersenne prime is a Prime number of the form ((2 power'n') - 1) where 'n' is a prime number. For eg. 31 is a prime and it is same as (2 power 5 - 1) where 5 is also a prime.

Input (int) Output (boolean)
31 true
3 true
17 false
6 false



class IsMersennePrime
{
    public static void main(String s[])
    {
        System.out.println("The given number is Mersenne's Prime : " + isMersennePrime(31));

    }


    public static boolean isMersennePrime(int number) {
    }
    

}

Doubts

Problems

Topic: Java for loops vs Java while loops vs Java do while loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App