Secondly, you could speed things up a little more: you only need to check all integer numbers up to ceil( $input / 2 ) because of the commutative properties of integers (2*3 == 3*2).
Furthermore, prime are always (except for '2', so almost always) odd numbers, so you could skip them in your test for even more speed improvement!
-- JaWi
"A chicken is an egg's way of producing more eggs."
In reply to Re: YAPNC: Yet another prime number checker?
by JaWi
in thread YAPNC: Yet another prime number checker?
by snafu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |