Hi guys! Today I wrote a program that finds the first 'n' prime numbers and I saw that when 'n' gets bigger, the necessary time for the program to run increases a lot. I found that the most acceptable value for n is 50,000.
I would please like some suggestions on how to make the program run faster.
This is the code:
with for(int j = 2; j <= sqrt(prime);j++) the program runs incredibly fast. I was able to calculate the first 1 million numbers in 37.515 seconds. Please let me know if you have any other ideas to make this even faster.