Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

RE: RE: RE: RE: RE: sieve of erothenes

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


in reply to RE: RE: RE: RE: sieve of erothenes
in thread sieve of erothenes

You know, you are right. I had thought I had done it in the right order, but I didn't... I screwed that up. I guess I would have to use:

@_=(1);L:for(2..100){$i=0;while(@_>++$i){next L if!($_%$_[$i])}push@_, +$_}
which uses 2 more chars. Sigh.

UPDATE: I can do it with one less char then above, but still too many.:

@_=(1);L:for(2..100){$i=-@_;while(++$i){next L if!($_%$_[$i])}push@_,$ +_}
Yes, I lie awake at night thinking about this stuff. No, not really. But when I get started thinking about it, I have a hard time stopping. But I doubt I'm alone in that disease. :)


Comment on RE: RE: RE: RE: RE: sieve of erothenes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2015-07-08 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls