Anti-primes: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: use atomic ops to try to avoid concurrency issues.)
m (→‎{{header|Perl 6}}: even more atomic)
Line 733: Line 733:
my @anti-primes = lazy 1, |(|(2..59), 60, *+60 … *).hyper.grep: -> $c {
my @anti-primes = lazy 1, |(|(2..59), 60, *+60 … *).hyper.grep: -> $c {
my \mx = +propdiv($c);
my \mx = +propdiv($c);
next if mx <= $last;
next if mx <= atomic-fetch($last);
atomic-assign: $last, mx;
atomic-assign($last, mx);
$c
$c
}
}