From 4065dedf701acbefb5b352adabefcd1c04b71257 Mon Sep 17 00:00:00 2001 From: Jeffrey Pinyan <90431423+jeffrey-pinyan-cleandns@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:31:04 -0500 Subject: perl 305.2 --- challenge-305/japhy/perl/ch-2.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 challenge-305/japhy/perl/ch-2.pl diff --git a/challenge-305/japhy/perl/ch-2.pl b/challenge-305/japhy/perl/ch-2.pl new file mode 100644 index 0000000000..d69c645fe9 --- /dev/null +++ b/challenge-305/japhy/perl/ch-2.pl @@ -0,0 +1,10 @@ +#!/usr/bin/perl -l + +print join ", " => alien(["perl", "python", "raku"], [qw/h l a b y d e f g i r k m n o p q j s t u v w x c z/]); +print join ", " => alien(["the", "weekly", "challenge"], [qw/c o r l d a b t e f g h i j k m n p q s w u v x y z/]); + +sub alien { + my $D = join "", @{+pop}; + my $t = sub { local $_ = shift; eval "y/a-zA-Z/$D$D/"; $_ }; + return sort { $t->($a) cmp $t->($b) } @{+shift}; +} -- cgit From 4a58f88115629d4258a1c885db87bbaf28af4db8 Mon Sep 17 00:00:00 2001 From: Jeffrey Pinyan <90431423+jeffrey-pinyan-cleandns@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:44:14 -0500 Subject: perl 305.1 --- challenge-305/japhy/perl/ch-1.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 challenge-305/japhy/perl/ch-1.pl diff --git a/challenge-305/japhy/perl/ch-1.pl b/challenge-305/japhy/perl/ch-1.pl new file mode 100644 index 0000000000..0865bc5419 --- /dev/null +++ b/challenge-305/japhy/perl/ch-1.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -l + +print join ", " => binprime(1, 0, 1); +print join ", " => binprime(1, 1, 0); +print join ", " => binprime(1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1); + +sub binprime { + my $n = 0; + map { + $n += $_[$_]; + $n <<= 1; + !((1 x ($n>>1)) =~ /^.$|^(..+)\1+$/); + } (0 .. $#_); +} -- cgit From 0c5aa2ba140523efe1b8732cd286114d1ac6b8ef Mon Sep 17 00:00:00 2001 From: Jeffrey Pinyan <90431423+jeffrey-pinyan-cleandns@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:44:39 -0500 Subject: Create README --- challenge-305/japhy/README | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-305/japhy/README diff --git a/challenge-305/japhy/README b/challenge-305/japhy/README new file mode 100644 index 0000000000..691f99b25a --- /dev/null +++ b/challenge-305/japhy/README @@ -0,0 +1 @@ +Solution by Jeffrey "japhy" Pinyan -- cgit