Special pythagorean triplet: Difference between revisions

→‎{{header|Raku}}: Add a Raku example
(Added related task.)
(→‎{{header|Raku}}: Add a Raku example)
Line 59:
</pre>
 
 
=={{header|Raku}}==
<lang perl6>hyper for 1..998 -> $a {
my $a2 = $a²;
for $a + 1 .. 999 -> $b {
my $c = 1000 - $a - $b;
last if $c < $b;
say "$a² + $b² = $c²\n$a + $b + $c = 1000" and exit if $a2 + $b² == $c²
}
}</lang>
{{out}}
<pre>200² + 375² = 425²
200 + 375 + 425 = 1000</pre>
 
=={{header|Ring}}==
10,339

edits