Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: (Golf): Sieve of Eratosthenes

by MeowChow (Vicar)
on May 20, 2001 at 00:45 UTC ( [id://81761]=note: print w/replies, xml ) Need Help??


in reply to (Golf): Sieve of Eratosthenes

Ok, how's 50 characters for the bonus:
sub sieve { grep!(map$_[$a*$_]++,1..$_[0]/($a=$_))[0],2..$_[0] }
update: Hmm, in my golfing frenzy, I seem to have increased the big-O back to that of the main problem, so I don't think this qualifies after all.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://81761]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found