use strict; use warnings; use 5.010; my @n; my @p; sub mk { my $l = shift; no warnings "redefine"; *is=eval 'sub { ' . join(' && ', map('$_[0] % '.$_, grep $_*$_ <= +$n[-1], @p), <<'EOCODE'); ($_[0] <= $l ? (push(@p, $_[0]), say($_[0])) : (unshift(@n, $_[0]), mk($p[-1]**2)) ) } EOCODE } @n=2..(shift//200); mk(2); is(shift @n) while @n;
In reply to number sifter by ysth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |