|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: Prime Number Finderby The_Rev (Acolyte) |
| on Feb 20, 2002 at 14:13 UTC ( #146582=note: print w/ replies, xml ) | Need Help?? |
|
I had made the post above ragrading half the iterations, but I just thought of a better way to calculate primes. Its not as fast, but its a one liner: while($num <= $max) { push @dynamic, $num if (1 x $num) !~ /^(11+)\1+$/; $num ++; } I hope you find this helpful
In Section
Snippets Section
|
|
||||||||||||||||||||||||||||||||||||||||