Mersenne Prime
Submissions: 322   Accuracy:


  Difficulty: Easy   Marks: 2

Mersenne Prime is a prime number that is one less than a power of two. In other words, any prime is Mersenne Prime if it is of the form 2k-1 where k is an integer greater than or equal to 2. First few Mersenne Primes are 3, 7, 31 and 127.

The task is print all Mersenne Primes smaller than an input positive integer n.




Print all the mersenne primes smaller than n in a sorted order. Print a space between two numbers.


1<= T <=100

1<= N <=100000







3 7

3 7 31


Contributor: Sujnesh Mishra
Author: sujnesh



to report an issue on this page.