#!usr/bin/perl -w use Benchmark; timethese(100,{ Adam => sub { @_=(1); L:for(2..1000) { $i=-@_; #updated per node 20757 7/13/2000 while(++$i){ #ditto next L if!($_%$_[$i]) } push@_,$_ } #print join "\t", @_; }, Maverick => sub { for(1..1000){ push@_,$_; for(@_[1..$#_-1]){ pop@_&&last if!($_[-1] %$_) } } #print join "\t", @_; }, Ase => sub { $v='1' x 1000; for(2..1000){ next if !vec($v,$_-1,8); for($q=$_*2;$q<1001;$q+=$_){ vec($v,$q-1,8)=0 } } #print join "\t",grep {vec($v,$_-1,8)} (1..1000); }, });