But then you are still far from being efficient. There's no need to loop to $num/2, you can stop at sqrt($num). There's no need to test even numbers (except 2). And there's no need to continue once you've found a divisor.
In reply to Re: is it prime?
by JavaFan
in thread is it prime?
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |