Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: Re: redmist's Diabolical Scheme for Prime Domination

by BlaisePascal (Monk)
on Aug 02, 2000 at 18:17 UTC ( [id://25735]=note: print w/replies, xml ) Need Help??


in reply to Re: redmist's Diabolical Scheme for Prime Domination
in thread redmist's Diabolical Scheme for Prime Domination

Here's my attempt at a Sieve of Eratothenes... I don't use grep that much, so I won't claim that this works...
@numbers = (2 .. 1_000_000); @primes = ( ); while (my $prime = shift @numbers) { push @primes,$prime; @numbers = grep { ($_ % $prime) != 0 } @numbers; } print $primes;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-18 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found