in reply to Re: Sieve of Eratosthenes Golf?
in thread Sieve of Eratosthenes Golf?

OK, I know I'm twisting things a little, but I don't consider the problem to be well formed anyway (what is the objective? to print all the prime numbers between 2 and 100? to implement the sieve of Erathosthenes? in a sub? with which output?)

Anyway, here's a basic enhancement, and I also trimmed two characters with s/100/99/ (hey, we all know 100 is not prime, right? O:-) )

for(2..99){$n{$y=$_}&&next;$n{$y+=$_}=1 while($_+$y)<=99;$n{$_}||print

I'm now at 71 chars.

Replies are listed 'Best First'.
Re^3: Sieve of Eratosthenes Golf?
by dragonchild (Archbishop) on Apr 07, 2005 at 13:24 UTC
    strict and warnings compliant at 77 characters ...
    $_{$.=$_}||do{{($_{$.+=$_}=$.+$_<=$,)&&redo}}for@.=2..($,=pop);grep!$_ +{$_},@.