summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-18 21:37:08 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-18 21:37:08 -0500
commitb34c80e0be08ea4d9c5533cfd525d2181bed35b5 (patch)
tree241beb411ad91c4d4d71d855ea777764b851aaf9
parent153ff9e564f243e75f33c8352f9b11c85c1e024d (diff)
downloadprojecteuler-b34c80e0be08ea4d9c5533cfd525d2181bed35b5.tar.gz
projecteuler-b34c80e0be08ea4d9c5533cfd525d2181bed35b5.zip
solution to 38
-rwxr-xr-x038.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/038.pl b/038.pl
new file mode 100755
index 0000000..78c256c
--- /dev/null
+++ b/038.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $max = 0;
+for my $n (2..9) {
+ for my $val (1..99999) {
+ my $pandigital = join '', map { $val * $_ } 1..$n;
+ next if length($pandigital) != 9;
+ next if join('', sort split //, $pandigital) ne '123456789';
+ $max = $pandigital if $pandigital > $max;
+ }
+}
+print "$max\n";