Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: (Golf): Sieve of Eratosthenes

by japhy (Canon)
on May 19, 2001 at 17:00 UTC ( #81707=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub p{my@x;map{my$c=$_;$_%$c||++$x[$_]for@_}@_=2..pop;grep$x[$_]==1,0.
    +.$#x}
    
  2. or download this
    sub p{@_=2..pop;my$c;while($_[$c]){@_=($_[$c],grep$_%$_[$c],@_);$c++}@
    +_}
    
  3. or download this
    sub p{@_=2..pop;my$c;@_=($_[$c++],grep$_%$_[$c-1],@_)while$c<@_;@_}
    
  4. or download this
    sub p{grep{my$c=$_;$#_==grep$c%$_,@_}@_=2..pop}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://81707]
help
Chatterbox?
[ww]: s/thought/found/
[erix]: that title is a broken* sentence, no? But maybe that's deliberate
[karlgoethebier]: ww:My first thought, to be honest...
[erix]: and those authors' names don't look like native english speakers. Then again, neither am I :)
[karlgoethebier]: but the set of test persons is very small, like in medical studies: "We analyzed 50..."

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-09-25 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?