aboutsummaryrefslogtreecommitdiff
path: root/challenge-169/james-smith/perl/ch-2-npp.pl
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-169/james-smith/perl/ch-2-npp.pl')
-rw-r--r--challenge-169/james-smith/perl/ch-2-npp.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-169/james-smith/perl/ch-2-npp.pl b/challenge-169/james-smith/perl/ch-2-npp.pl
new file mode 100644
index 0000000000..a3d686dc25
--- /dev/null
+++ b/challenge-169/james-smith/perl/ch-2-npp.pl
@@ -0,0 +1,18 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use warnings;
+use feature qw(say);
+use Math::Prime::Util qw(factor_exp gcd);
+use Time::HiRes qw(time);
+
+my $time = time;
+
+#-------------------------------------------------------------------------------
+for( my( $c, $n ) = ( 100 ); $c; ) {
+ $c--, say $n if 1 == gcd map{ $_->[1] < 2 ? next : $_->[1] } factor_exp ++$n;
+}
+
+warn 'Time taken: ', time-$time, "\n";
+