(Somewhat) Fast Prime Number Generator
h
MrEconomical (441)

Given a number N, this program calculates the Nth prime number.

Essentially, this program loops through all the odd numbers until it has found N prime numbers. To check if a number is prime, it checks divisbility by all the primes up to the sqrt of the number (which is why a primelist was generated), or if the sqrt is too big, it just loops through odd numbers.

Since repl.it is a "VM streamed over the internet," this program runs significantly slower than if it were to be run on your local machine, but it still is decently fast.

You are viewing a single comment. View All