Anti-primes: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: Concurrency not really necessary, and causing races under load.)
Line 875: Line 875:
}
}


my atomicint $last = 0;
my $last = 0;


my @anti-primes = lazy 1, |(|(2..59), 60, *+60 … *).hyper.grep: -> $c {
my @anti-primes = lazy 1, |(|(2..59), 60, *+60 … *).grep: -> $c {
my \mx = +propdiv($c);
my \mx = +propdiv($c);
next if mx <= atomic-fetch($last);
next if mx <= $last;
atomic-assign($last, mx);
$last = mx;
$c
$c
}
}