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

RE: sieve of erothenes

by Adam (Vicar)
on Jul 01, 2000 at 03:05 UTC ( #20691=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @_=(1);
    L:for(2..100)
    ...
       push @_,$_
    }
    print join(" ",@_),"\n";
    
  2. or download this
    sub Adam () 
    { @_=(1);L:for(2..100){$i=@_;while(--$i){next L unless $_%$_[$i]}push 
    +@_,$_} @_ }
    sub Maverick ()
    { for(1..100){push @_,$_;for(@_[1..($#_-1)]){pop @_ and last unless $_
    +[-1]%$_}} @_ }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://20691]
help
Chatterbox?
[stevieb]: TFIF. Way too stressful of a week at work. Glad it's over :)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-07-21 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (335 votes). Check out past polls.