Anti-primes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: use atomic ops to try to avoid concurrency issues.) |
Thundergnat (talk | contribs) 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 |
atomic-assign($last, mx); |
||
$c |
$c |
||
} |
} |