in reply to RE: sieve of erothenes
in thread sieve of erothenes
I kept trying to think of how do this with maps and maybe come out with something different, but nothing has come to me yetsub A { @_=(1);L:for(2..100){$i=@_;while(--$i){next L if!($_%$_[$i])}p +ush@_,$_} } sub M { for(1..100){push@_,$_;for(@_[1..$#_-1]){pop@_ and last if!($_[ +-1]%$_)}} } print join(" ",@_),"\n";
sub A { @_=(1);L:for(2..100){$i=@_;while(--$i){next L if!($_%$_[$i])}p +ush@_,$_} } sub M { for(1..100){push@_,$_;for(@_[1..$#_-1]){pop@_&&last if!($_[-1] +%$_)}} }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: RE: sieve of erothenes
by Adam (Vicar) on Jul 01, 2000 at 03:52 UTC | |
by maverick (Curate) on Jul 01, 2000 at 08:44 UTC | |
by husker (Chaplain) on Jul 05, 2000 at 18:05 UTC | |
by Adam (Vicar) on Jul 01, 2000 at 22:12 UTC |