I need to find a certain amount of prime numbers in ascending order, starting from 2. I have a working algorithm which takes a number-limit as a parameter - it finds all primes that are less than the limit.
For example - for param 20 it would return 2,3,5,7,11,13,17,19, but I need to input 5 and get 2,3,5,7,11. What is the best way? I am using the Sieve of Eratosthenes and there is no way to limit the number-deleting part, since I don't know how big the 195th prime number is and I therefore don't know if I should delete all multiples of 2 up to 1568 or 1268426. I hope the question is clear, thanks for help