in reply to YAPNC: Yet another prime number checker?
next if ( $last_digit == 5 or $last_digit = 0 );
did you mean:
next if ( $last_digit == 5 or $last_digit == 0 );
also to make it run even faster you might want to look to have it only check from $input to sqrt($input). If it does not fail up to the
sqrt($input) it will not fail past that point.
-Enlil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: YAPNC: Yet another prime number checker?
by snafu (Chaplain) on Oct 08, 2002 at 23:02 UTC |