I am doing some analytical program in C++ involving a lot of prime numbers. I don't think checking a number every time, whether it is prime or not would be a good idea.
So I just thought that if I could pre generate all the prime numbers in a list.
But it is taking too much. Time.
almost 4-5 second. I hate to find it upto 1000,000
Is there any better way?