+ 5
CHALLENGE: What is the largest prime number you can calculate inside sololearn's playground?
As you know, if the programs takes too long, you get the message "time limit exceeded" in the playground. whitin this time limit, what is the biggest prime number you can calculate? Assumption: no prime numbers is initially saved inside the program. Assumption2: you can start searching from any number you want.
4 ответов
+ 5
So, the problem of this is the time your data needs to be transferred to the servers and back, the biggest primes you can calculate using Javascript, because it runs on your device:
You cannot see how far it goes because your processor is working but if your tested number is higher, it takes more time to calculate.
100.000 should work either.
https://code.sololearn.com/Wu1waqWHw3Ln/?ref=app
+ 4
yes! But mostly I mean the best algorithm that any one can suggest. Better algorithms than just dividing any number to all of the smaller numbers to check for primality.. for instance, Lucas–Lehmer primality test or maybe something else..