Heronian triangles: Difference between revisions

m
→‎{{header|Perl 6}}: use atomicint to make concurrency safe
m (→‎using iSQRT: added whitespace, aligned the END with the DO loop.)
m (→‎{{header|Perl 6}}: use atomicint to make concurrency safe)
Line 3,284:
sub MAIN ($maxside = 200, $first = 10, $witharea = 210) {
my @hhh[1000];
my atomicint $i;
(1 .. $maxside).race.map: -> $c {
for 1 .. $c -> $b {
for $c - $b + 1 .. $b -> $a {
if primitive-heronian-area($a,$b,$c) -> $area {
@h.push:hh[$i⚛++] = [$area, $a+$b+$c, $c, $b, $a];
}
}
}
}
 
@h = (@hhh.grep: so *).sort;
say "Primitive Heronian triangles with sides up to $maxside: ", +@h;
 
2,392

edits