Share your repls and programming experiences

← Back to all posts
(Somewhat) Fast Prime Number Generator
h
MrEconomical (378)

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.

Commentshotnewtop
enigma_dev (535)

I think I just crashed the whole container with a number of 1 billion. oops