It might help to replace the $num++ by $num += 2 since 2 is the only prime number that is even. This saves you half the tests for primality if you have 2 as a special case.
Best, -gjb-
In reply to Re: Prime Iterator
by gjb
in thread Prime Iterator
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |