C++ prime number handling. Please help…
Hi,
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.
vector<int> prmn;
For (int i=2; I<100000; ++i)
If (isprime (I)) {
prmn.push_back(i);
}
Almost 4-5 second. I hate to find it upto 1000,000.
Is there any better way?








