aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-133/abigail/perl/ch-2.pl7
1 files changed, 3 insertions, 4 deletions
diff --git a/challenge-133/abigail/perl/ch-2.pl b/challenge-133/abigail/perl/ch-2.pl
index 178c362ab3..506e4ca1e6 100644
--- a/challenge-133/abigail/perl/ch-2.pl
+++ b/challenge-133/abigail/perl/ch-2.pl
@@ -27,12 +27,11 @@ my $COUNT = 10;
#
# Return the sum of the digits of the set of given numbers.
#
-sub digitsum (@n) {sum map {split //} @n}
+sub digitsum (@n) {sum "@n" =~ /\d/ag}
my $c = 0;
-my $n = 1;
+my $n = 0;
do {
- my @factors = factor $n;
+ my @factors = factor ++ $n;
$c ++, say $n if @factors > 1 && digitsum ($n) == digitsum @factors;
- $n ++;
} until $c == $COUNT;