aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.freedom.nl>2021-12-21 01:06:41 +0100
committerAbigail <abigail@abigail.freedom.nl>2021-12-21 01:06:41 +0100
commit11bec869bb9269ab76e427e90a5d6d367bfdc41c (patch)
tree0f953ec6f1f13dbea024d73ddb5000acef4becc9
parent17f5562a76a8c54ea21fde11945f80ab697aed23 (diff)
downloadperlweeklychallenge-club-11bec869bb9269ab76e427e90a5d6d367bfdc41c.tar.gz
perlweeklychallenge-club-11bec869bb9269ab76e427e90a5d6d367bfdc41c.tar.bz2
perlweeklychallenge-club-11bec869bb9269ab76e427e90a5d6d367bfdc41c.zip
Make it even more boring
-rw-r--r--challenge-144/abigail/perl/ch-1.pl13
1 files changed, 5 insertions, 8 deletions
diff --git a/challenge-144/abigail/perl/ch-1.pl b/challenge-144/abigail/perl/ch-1.pl
index e65ce40412..f2908f64f6 100644
--- a/challenge-144/abigail/perl/ch-1.pl
+++ b/challenge-144/abigail/perl/ch-1.pl
@@ -18,19 +18,16 @@ use experimental 'lexical_subs';
#
#
-# And the upteenth time in succession, we'll use the divisors method.
+# And the upteenth time in succession, we'll use Math::Prime::Util
#
-# BBOOOOOOOOOOOOORRRRRRRRRRRRRRRIIIIIIIIIIIIIIINNNNNNNNNNNNGGGGGGGGGG
+# BBBBBBBBBBOOOOOOOOOOORRRRRRRRRRRIIIIIIIIIIINNNNNNNNNNNGGGGGGGGGG
#
# Besides, ANY challenge of the form "print the first N terms of an
# OEIS sequence" is a trivial glorified hello world program.
#
-# Semiprimes have either 3 (squares of primes) or 4 divisors (product
-# of two primes), but should not be cubes of primes. They only cubes
-# of primes < 100 are 8 and 27.
+# Semiprimes have exactly 2 factors.
#
-use Math::Prime::Util qw [divisors];
-my %cubes = map {$_ => 1} 8, 27;
+use Math::Prime::Util qw [factor];
-say join ", " => grep {!$cubes {$_} && 3 <= divisors ($_) <= 4} 1 .. 100;
+say join ", " => grep {2 == factor $_} 1 .. 100;