#!/usr/bin/env pugs =begin Problem A Pythagorean triplet is a set of three natural numbers, a 333, so a+b+c>1000 for 1..333 -> $a { # a < b so start b at a+1 # if b >= 500, then b+c>1000 for $a+1 .. 500 -> $b { my $c = sqrt($a*$a + $b*$b); next unless $a + $b + $c == 1000; say $a * $b * $c; return; } } } my @t = timeit(1, \&main); say "execution time: @t[0]"