aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-261/wlmb/blog.txt1
-rwxr-xr-xchallenge-261/wlmb/perl/ch-1.pl13
-rwxr-xr-xchallenge-261/wlmb/perl/ch-2.pl15
3 files changed, 29 insertions, 0 deletions
diff --git a/challenge-261/wlmb/blog.txt b/challenge-261/wlmb/blog.txt
new file mode 100644
index 0000000000..caa8f9c76e
--- /dev/null
+++ b/challenge-261/wlmb/blog.txt
@@ -0,0 +1 @@
+https://wlmb.github.io/2024/03/18/PWC261/
diff --git a/challenge-261/wlmb/perl/ch-1.pl b/challenge-261/wlmb/perl/ch-1.pl
new file mode 100755
index 0000000000..be54582864
--- /dev/null
+++ b/challenge-261/wlmb/perl/ch-1.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 261
+# Task 1: Element Digit Sum
+#
+# See https://wlmb.github.io/2024/03/18/PWC261/#task-1-element-digit-sum
+use v5.36;
+use List::Util qw(sum0);
+die <<~"FIN" unless @ARGV;
+ usage: $0 N1 [N2...]
+ to find the diference between the sum of the numbers N1+N2+...
+ and the sum of their digits
+ FIN
+say "@ARGV -> ", sum0 map {$_-sum0 split""} @ARGV;
diff --git a/challenge-261/wlmb/perl/ch-2.pl b/challenge-261/wlmb/perl/ch-2.pl
new file mode 100755
index 0000000000..52d50e3b1e
--- /dev/null
+++ b/challenge-261/wlmb/perl/ch-2.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 261
+# Task 2: Multiply by Two
+#
+# See https://wlmb.github.io/2024/03/18/PWC261/#task-2-multiply-by-two
+use v5.36;
+use List::Util qw(first);
+die <<~"FIN" unless @ARGV >= 2;
+ Usage: $0 S N1 [N2...]
+ to find the smallest number S*2^n that is not in the list N1 N2...
+ FIN
+my ($start, @ints)=@ARGV;
+print "Start=$start, ints=@ints -> ";
+$start *= 2 while defined first {$_==$start} @ints;
+say $start;