There's more than one way to do things | |
PerlMonks |
Re^6: Number functions.. primes (ugly code runs faster)by Discipulus (Canon) |
on Apr 02, 2015 at 20:55 UTC ( [id://1122306]=note: print w/replies, xml ) | Need Help?? |
Thanks for spotting it. Lesson learned: never skip tests for data with more than five elements. So for the prime number 149 the hardcoded check has to be: All the matter about how many primes check to hardcode and about increese and decreese of performances was vain. But even if it was just a divertissment now i have to go on.. With the correct code, primes between 11 and 37 gives good results, especially 11. The prime number 11 was the winner benchmarking prime reserch in numbers up to 10K, 100K e 1M. So the answer is no more 42. L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Cool Uses for Perl
|
|