From 97f18c609654664782441bca016a400b7592e4c9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 14 May 2009 20:03:00 -0500 Subject: add solution for problem 9 --- 009.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 009.pl (limited to '009.pl') diff --git a/009.pl b/009.pl new file mode 100755 index 0000000..73cafeb --- /dev/null +++ b/009.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl +use strict; +use warnings; + +A: for my $a (1..1000) { + B: for my $b (1..(1000 - $a)) { + my $c = 1000 - $a - $b; + next A if $c <= 0; + if ($a**2 + $b**2 == $c**2) { + print "$a, $b, $c: ", $a * $b * $c, "\n"; + last A; + } + } +} -- cgit v1.2.3