Oct-28-2017, 04:44 AM
(This post was last modified: Oct-28-2017, 04:44 AM by PythonLamer.)
(Oct-28-2017, 03:08 AM)heiner55 Wrote: If I google for "prime number algorithm", I get a lot of suggestions.
Maybe you should also google.
It is enough to end the for-loop if sqrt(n) instead of n/2.
You could save the result of isPrime(2*i+1), because you need it later again for isPrime(i).
That's actually quite a bit faster. Thank you.