Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: This One's a Sieveby Athanasius (Archbishop) |
on Apr 01, 2015 at 15:27 UTC ( [id://1122160]=note: print w/replies, xml ) | Need Help?? |
Nice! But the pedant in me feels compelled to point out that for a 35% increase in length, this obfu can be made significantly more time-efficient:
The speed increase is negligible for low values of $m, but for large value it becomes significant (e.g. an increase of nearly 8 times in speed for $m equal to ten million):
Output:
But note that this version is still inefficient. See johngg’s recent post: Re^3: Number functions I have lying around, which saves on (1) cpu time by iterating only up to sqrt($m), and (2) memory by storing the sieve in a bit vector. Hope this is of interest,
In Section
Obfuscated Code
|
|