Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Prime number generator

by liverpole (Monsignor)
on Jul 17, 2006 at 20:54 UTC ( #561854=note: print w/ replies, xml ) Need Help??

in reply to Re: Prime number generator
in thread Prime number generator

Stunning! ++

But you realize, of course ...

#!/usr/bin/perl -l $o=1;{(grep!($o%$_),2..$o++)||print$o;redo}

That's 43.

It's a little slower (but then we sacrificed speed a while back ;-))

Update:  Make that 42 ...

#!/usr/bin/perl -l $o=1;{grep!($o%$_),2..$o++or print$o;redo}


Comment on Re^2: Prime number generator
Select or Download Code
Replies are listed 'Best First'.
Re^3: Prime number generator
by rhesa (Vicar) on Jul 17, 2006 at 21:11 UTC
    Hey, making it post-increment is clever! Well spotted :)

    I had a hard time getting those stupid brackets out of there. At some point, I realised that I was being bitten by buffered output, and didn't think about them anymore.

    I think 42 is perfect!

Re^3: Prime number generator
by Ieronim (Friar) on Jul 17, 2006 at 21:30 UTC
    Cool :) ++

         s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2015-11-26 05:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls