+ 8

Challenge: Mersenne primes

Mersenne primes are prime numbers that are 1 less a power of 2. the exponent of the power must be a prime number, so a mersenne prime (n) satisfies this relation: n=2^p-1 (p is prime) task: write a code - in any language you prefer - that, once user provedes an input x finds all mersenne primes from 1 to x happy coding :)

29th Aug 2017, 9:03 AM
Luca
Luca - avatar
14 Answers
29th Aug 2017, 9:54 AM
Louis
Louis - avatar
+ 8
Fun fact! The Largest prime no is also Mersenne prime It is (2 ^ 74,207,281) − 1 It has 22,338,618 digits!!
30th Aug 2017, 4:45 AM
Abhishek Tandon
Abhishek Tandon - avatar
30th Aug 2017, 4:39 AM
Abhishek Tandon
Abhishek Tandon - avatar
29th Aug 2017, 7:11 PM
LukArToDo
LukArToDo - avatar
+ 4
https://code.sololearn.com/cbd7t8ao2LFV/?ref=app
30th Aug 2017, 3:52 PM
hamletmun
hamletmun - avatar
29th Aug 2017, 9:18 AM
Αητοιπe
Αητοιπe - avatar
29th Aug 2017, 10:17 AM
Sangilivelu
Sangilivelu - avatar
+ 3
Hello ! I wrote my code in Python and I think it's pretty fast. Here is my code : https://code.sololearn.com/csMaTsZr6TSc/#py
30th Aug 2017, 11:35 AM
Oberyin
Oberyin - avatar
+ 2
nice code, Antoine!
29th Aug 2017, 9:25 AM
Luca
Luca - avatar
29th Aug 2017, 11:00 AM
MineMaster1999
+ 2
Hello, I think I've got the purest algorithm :) https://code.sololearn.com/W23pKl8Ih2Vb/#html You can enter limit of a 2.5 billion with a waiting time of 20 seconds.
30th Aug 2017, 2:16 PM
Mehmet
Mehmet - avatar
+ 1
whoa, nice code!
30th Aug 2017, 11:36 AM
Luca
Luca - avatar
30th Aug 2017, 11:35 PM
Petros Simidyan
Petros Simidyan - avatar
0
Hi.Who know how save a commant in a web site with tags "input"?of curse with PHP or other languages.
4th Sep 2017, 6:48 PM
Metaaa