summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-16 12:50:37 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-16 12:50:37 -0500
commit4c97262a413394e77cc929e97935bc6ac8a5372e (patch)
tree4bc6d0ca28e08ccda32276c2f3dd01161936c4b8
parente8d95e142316558172c63db24bf6234f59299128 (diff)
downloadprojecteuler-4c97262a413394e77cc929e97935bc6ac8a5372e.tar.gz
projecteuler-4c97262a413394e77cc929e97935bc6ac8a5372e.zip
problem 69, my first non-brute-force solution!
-rwxr-xr-x069.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/069.pl b/069.pl
new file mode 100755
index 0000000..66d3d7c
--- /dev/null
+++ b/069.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Math::Prime::XS qw/sieve_primes/;
+
+my @primes = sieve_primes(1e4);
+
+my $prod = 1;
+for my $prime (@primes) {
+ $prod *= $prime;
+ if ($prod > 1e6) {
+ $prod /= $prime;
+ last;
+ }
+}
+print "$prod\n";