diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-16 12:50:37 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-16 12:50:37 -0500 |
commit | 4c97262a413394e77cc929e97935bc6ac8a5372e (patch) | |
tree | 4bc6d0ca28e08ccda32276c2f3dd01161936c4b8 | |
parent | e8d95e142316558172c63db24bf6234f59299128 (diff) | |
download | projecteuler-4c97262a413394e77cc929e97935bc6ac8a5372e.tar.gz projecteuler-4c97262a413394e77cc929e97935bc6ac8a5372e.zip |
problem 69, my first non-brute-force solution!
-rwxr-xr-x | 069.pl | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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"; |