diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-06-17 13:29:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-17 13:29:35 +0100 |
| commit | 487570e2109b3562e5c8bbe3f5a46db888e9452f (patch) | |
| tree | 164efef09eecd4294af2451807e7cc7515d490cc | |
| parent | 5b0d246bd5aecc5e6c45a054011f156eb0630a3e (diff) | |
| parent | 966d0802b28d404a4fb446c1e2f8d9b8c4d72aef (diff) | |
| download | perlweeklychallenge-club-487570e2109b3562e5c8bbe3f5a46db888e9452f.tar.gz perlweeklychallenge-club-487570e2109b3562e5c8bbe3f5a46db888e9452f.tar.bz2 perlweeklychallenge-club-487570e2109b3562e5c8bbe3f5a46db888e9452f.zip | |
Merge pull request #267 from joetym/jtym-challenge12
now in a working state
| -rw-r--r-- | challenge-012/joe-tym/perl5/ch-1.pl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/challenge-012/joe-tym/perl5/ch-1.pl b/challenge-012/joe-tym/perl5/ch-1.pl index 7f4bce24ae..d5ad7a36eb 100644 --- a/challenge-012/joe-tym/perl5/ch-1.pl +++ b/challenge-012/joe-tym/perl5/ch-1.pl @@ -8,26 +8,29 @@ use Data::Dumper; =head1 synopsis http://blogs.perl.org/users/laurent_r/2019/06/perl-weekly-challenge-12-euclids-numbers-and-directories.html - Refactored to use Perl Data Language(PDL), Perl's numpy equivalent to calculate prime numbers + Refactored to use Perl Data Language(PDL), Perl's numpy equivalent, to calculate prime numbers =cut main(); sub main { - my $primes = primesfrom2to(31000); - print $primes->where($primes > 30000); exit; - #print is_prime($primes, 13); + my $primes = primesfrom2to(31000); + #print $primes->where($primes > 30000); exit; + #print is_prime($primes, 13); my @prime_numbers = $primes->list(); - print is_prime($primes, 30031); + #print is_prime($primes, 30031); for my $i (0..20) { my $euclid_1 = 1; $euclid_1 *= $prime_numbers[$_] for 0..$i; my $euclid = $euclid_1 + 1; - print Dumper($euclid); - say $euclid and last unless is_prime($primes, $euclid); + #print Dumper($euclid); + if (!is_prime($primes, $euclid)) { + print $euclid; + exit; + } } } |
