aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-11-24 01:07:43 +0000
committerGitHub <noreply@github.com>2021-11-24 01:07:43 +0000
commit6c5bd1dacec7f4db4e549d2c9d21cf2e07f82b66 (patch)
tree781f44ab55861383deacbd68ec2a43a87d1d0fb9
parent7f21ae7de25b5f174cd59ff5ddc2c88e6c3e3484 (diff)
parent3601ca3aa16b14a9bd81294925e293a12d4baf98 (diff)
downloadperlweeklychallenge-club-6c5bd1dacec7f4db4e549d2c9d21cf2e07f82b66.tar.gz
perlweeklychallenge-club-6c5bd1dacec7f4db4e549d2c9d21cf2e07f82b66.tar.bz2
perlweeklychallenge-club-6c5bd1dacec7f4db4e549d2c9d21cf2e07f82b66.zip
Merge pull request #5265 from seaker/master
Challenge #140, Feng Chang's Raku solutions, and more
-rwxr-xr-xchallenge-118/feng-chang/raku/ch-1.raku6
-rwxr-xr-xchallenge-118/feng-chang/raku/ch-2.raku71
-rwxr-xr-xchallenge-119/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-119/feng-chang/raku/ch-2.raku12
-rwxr-xr-xchallenge-120/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-120/feng-chang/raku/ch-2.raku6
-rwxr-xr-xchallenge-121/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-121/feng-chang/raku/ch-2.raku25
-rw-r--r--challenge-121/feng-chang/raku/d02.txt4
-rwxr-xr-xchallenge-122/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-122/feng-chang/raku/ch-2.raku10
-rwxr-xr-xchallenge-123/feng-chang/raku/ch-1.raku16
-rwxr-xr-xchallenge-123/feng-chang/raku/ch-2.raku23
-rwxr-xr-xchallenge-124/feng-chang/raku/ch-1.raku9
-rwxr-xr-xchallenge-124/feng-chang/raku/ch-2.raku17
-rwxr-xr-xchallenge-126/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-126/feng-chang/raku/ch-2.raku22
-rw-r--r--challenge-126/feng-chang/raku/input.txt5
-rwxr-xr-xchallenge-128/feng-chang/raku/ch-1.raku17
-rwxr-xr-xchallenge-128/feng-chang/raku/ch-2.raku22
-rw-r--r--challenge-128/feng-chang/raku/in02.txt3
-rw-r--r--challenge-128/feng-chang/raku/input.txt3
-rw-r--r--challenge-128/feng-chang/raku/times.txt2
-rw-r--r--challenge-128/feng-chang/raku/tm02.txt2
-rwxr-xr-xchallenge-132/feng-chang/raku/ch-1.raku11
-rwxr-xr-xchallenge-133/feng-chang/raku/ch-1.raku17
-rwxr-xr-xchallenge-133/feng-chang/raku/ch-2.raku28
-rwxr-xr-xchallenge-134/feng-chang/raku/ch-1.raku3
-rwxr-xr-xchallenge-134/feng-chang/raku/ch-2.raku22
-rwxr-xr-xchallenge-135/feng-chang/raku/ch-1.raku15
-rwxr-xr-xchallenge-135/feng-chang/raku/ch-2.raku19
-rwxr-xr-xchallenge-136/feng-chang/raku/ch-1.raku9
-rwxr-xr-xchallenge-136/feng-chang/raku/ch-2.raku11
-rwxr-xr-xchallenge-137/feng-chang/perl/ch-1.pl12
-rwxr-xr-xchallenge-137/feng-chang/raku/ch-1.raku7
-rwxr-xr-xchallenge-137/feng-chang/raku/ch-2.raku21
-rwxr-xr-xchallenge-138/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-138/feng-chang/raku/ch-2.raku23
-rwxr-xr-xchallenge-139/feng-chang/raku/ch-1.raku5
-rwxr-xr-xchallenge-139/feng-chang/raku/ch-2.raku10
-rwxr-xr-xchallenge-140/feng-chang/raku/ch-1.raku33
-rwxr-xr-xchallenge-140/feng-chang/raku/ch-2.raku5
42 files changed, 556 insertions, 0 deletions
diff --git a/challenge-118/feng-chang/raku/ch-1.raku b/challenge-118/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..403b9cf5d6
--- /dev/null
+++ b/challenge-118/feng-chang/raku/ch-1.raku
@@ -0,0 +1,6 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $n) {
+ my Str $s = $n.base(2);
+ put +($s.flip eq $s);
+}
diff --git a/challenge-118/feng-chang/raku/ch-2.raku b/challenge-118/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..863ebee873
--- /dev/null
+++ b/challenge-118/feng-chang/raku/ch-2.raku
@@ -0,0 +1,71 @@
+#!/bin/env raku
+
+=begin puzzle
+ a b c d e f g h
+ 8 N * * * * * * * 8
+ 7 * * * * * * * * 7
+ 6 * * * * x * * * 6
+ 5 * * * * * * * * 5
+ 4 * * x * * * * * 4
+ 3 * x * * * * * * 3
+ 2 x x * * * * * * 2
+ 1 * x * * * * * * 1
+ a b c d e f g h
+
+ 0 1 2 3 4 5 6 7
+ 0 N * * * * * * *
+ 1 * * * * * * * *
+ 2 * * * * x * * *
+ 3 * * * * * * * *
+ 4 * * x * * * * *
+ 5 * x * * * * * *
+ 6 x x * * * * * *
+ 7 * x * * * * * *
+=end puzzle
+
+my UInt $least-steps = 128;
+
+sub score(Array:D $pos, Set:D $targets, Set:D $unreached, Array:D $path --> UInt:D) {
+ my UInt $score = 10;
+ $score -= $path.grep($pos).elems;
+ if $pos (elem) $unreached {
+ ++$score;
+ ++$score if $pos (elem) $targets;
+ }
+
+ $score
+}
+
+sub walk(Array:D $pos, Set:D $targets, Set:D $unreached, Array:D $path) {
+ return if $path.elems > $least-steps;
+
+ if $targets.keys == 0 {
+ put "{ $path.elems } steps: { $path.gist }";
+ $least-steps = $path.elems if $path.elems < $least-steps;
+ return;
+ }
+
+ my @candidates = gather
+ for (1,2), (1,-2), (-1,2), (-1,-2), (2,1), (2,-1), (-2,1), (-2,-1) -> ($r, $c) {
+ #put "«$r $c»";
+ my Int $row = $pos[0] + $r;
+ next if $row < 0 or $row > 7;
+ my Int $col = $pos[1] + $c;
+ next if $col < 0 or $col > 7;
+ take [$row, $col].item;
+ }
+ my @score = @candidates.map({ score($_, $targets, $unreached, $path) });
+ (^@candidates.elems).sort(??);
+ 排序怪怪的???
+
+ my Array $new-pos = ($row, $col).Array;
+ put "new pos { $new-pos.gist }";
+
+ my Array $new-path = $path.deepmap(*.clone);
+ $new-path.push($new-pos);
+
+ walk($new-pos, $targets (-) ($new-pos).Set, $new-path);
+ }
+}
+
+walk([0, 0], ([2,4], [4,2], [5,1], [6,0], [6,1], [7,1]).Set, ([0, 0].item).Array);
diff --git a/challenge-119/feng-chang/raku/ch-1.raku b/challenge-119/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..5d2c207f55
--- /dev/null
+++ b/challenge-119/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $N where * ≤ 255) {
+ put $N.fmt('%02x').comb.reverse.join.parse-base(16);
+}
diff --git a/challenge-119/feng-chang/raku/ch-2.raku b/challenge-119/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..28cbbbaa08
--- /dev/null
+++ b/challenge-119/feng-chang/raku/ch-2.raku
@@ -0,0 +1,12 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $N where $N > 0) {
+ my Seq $trin = gather for 1..∞ -> $i {
+ my $n = $i.base(4);
+ next if $n ~~ m/0/;
+ next if $n ~~ m/11/;
+ take $n;
+ }
+
+ put $trin[$N - 1];
+}
diff --git a/challenge-120/feng-chang/raku/ch-1.raku b/challenge-120/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..0f2bbaee1d
--- /dev/null
+++ b/challenge-120/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $N where * ≤ 255) {
+ put (($N +& 85) +< 1) +| (($N +& 170) +> 1);
+}
diff --git a/challenge-120/feng-chang/raku/ch-2.raku b/challenge-120/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..bbdc79ab09
--- /dev/null
+++ b/challenge-120/feng-chang/raku/ch-2.raku
@@ -0,0 +1,6 @@
+#!/bin/env raku
+
+sub MAIN(Str:D $T) {
+ $T ~~ m/^ (\d\d) ':' (\d\d) $/;
+ put abs(($0 % 12) * 30 - ($1 % 60) * 5.5);
+}
diff --git a/challenge-121/feng-chang/raku/ch-1.raku b/challenge-121/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..01e14e1b19
--- /dev/null
+++ b/challenge-121/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $m where 0 ≤ * ≤ 255, UInt:D $n where 1 ≤ * ≤ 8) {
+ put $m +^ (1 +< ($n - 1));
+}
diff --git a/challenge-121/feng-chang/raku/ch-2.raku b/challenge-121/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..cde0da4f14
--- /dev/null
+++ b/challenge-121/feng-chang/raku/ch-2.raku
@@ -0,0 +1,25 @@
+#!/bin/env raku
+
+my $shortest-length;
+my Array $shortest-path;
+
+sub distance(Array:D $TS, List:D $path) {
+ my Array:D $p = [0, |$path, 0];
+ my $dist = [+] (^$TS.elems).map({ $TS[$p[$_];$p[$_+1]] });
+ if $dist < $shortest-length {
+ $shortest-length = $dist;
+ $shortest-path = $p;
+ }
+
+ $dist
+}
+
+sub MAIN(Str:D $f where *.IO.e) {
+ my Array $TS .= new;
+ $f.IO.lines.map({ $TS.push($_.words».UInt.Array) });
+
+ $shortest-length = [+] $TS».max;
+
+ put (1..^$TS.elems).permutations.map({ distance($TS, $_) }).min;
+ put $shortest-path.gist;
+}
diff --git a/challenge-121/feng-chang/raku/d02.txt b/challenge-121/feng-chang/raku/d02.txt
new file mode 100644
index 0000000000..a389324b02
--- /dev/null
+++ b/challenge-121/feng-chang/raku/d02.txt
@@ -0,0 +1,4 @@
+0 5 2 7
+5 0 5 3
+3 1 0 6
+4 5 4 0
diff --git a/challenge-122/feng-chang/raku/ch-1.raku b/challenge-122/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..0e04b73ce8
--- /dev/null
+++ b/challenge-122/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(*@N) {
+ put (^@N.elems).map({ @N[0..$_].sum / ($_+1) });
+}
diff --git a/challenge-122/feng-chang/raku/ch-2.raku b/challenge-122/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..f2a11cd67e
--- /dev/null
+++ b/challenge-122/feng-chang/raku/ch-2.raku
@@ -0,0 +1,10 @@
+#!/bin/env raku
+
+sub score(UInt:D $N, Array:D $s) {
+ put $s if $N == 0;
+ score($N - 1, [|$s, 1]) if $N ≥ 1;
+ score($N - 2, [|$s, 2]) if $N ≥ 2;
+ score($N - 3, [|$s, 3]) if $N ≥ 3;
+}
+
+sub MAIN(UInt:D $N) { score($N, []) }
diff --git a/challenge-123/feng-chang/raku/ch-1.raku b/challenge-123/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..d738e1cb39
--- /dev/null
+++ b/challenge-123/feng-chang/raku/ch-1.raku
@@ -0,0 +1,16 @@
+#!/bin/env raku
+
+my method is-ugly(Int:D $n: --> Bool:D) {
+ my UInt $m = $n;
+
+ $m div= 2 while $m %% 2;
+ $m div= 3 while $m %% 3;
+ $m div= 5 while $m %% 5;
+
+ so $m == 1
+}
+
+sub MAIN(UInt:D $n where * > 0) {
+ my @uglies = (1..∞).grep(*.&is-ugly);
+ put @uglies[$n-1];
+}
diff --git a/challenge-123/feng-chang/raku/ch-2.raku b/challenge-123/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..30e459d0b4
--- /dev/null
+++ b/challenge-123/feng-chang/raku/ch-2.raku
@@ -0,0 +1,23 @@
+#!/bin/env raku
+
+sub dist2(Int:D \x1, Int:D \y1, Int:D \x2, Int:D \y2 --> UInt:D) {
+ (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
+}
+
+sub is-square(
+ Int:D \x1, Int:D \y1,
+ Int:D \x2, Int:D \y2,
+ Int:D \x3, Int:D \y3,
+ Int:D \x4, Int:D \y4
+--> Bool:D) {
+ [==] dist2(x1,y1,x2,y2), dist2(x2,y2,x3,y3), dist2(x3,y3,x4,y4), dist2(x4,y4,x1,y1)
+}
+
+sub MAIN(*@N where *.elems == 8) {
+ put + [or] (1..3).permutations.map({ is-square(
+ @N[0], @N[1],
+ @N[.[0]*2], @N[.[0]*2+1],
+ @N[.[1]*2], @N[.[1]*2+1],
+ @N[.[2]*2], @N[.[2]*2+1]
+ ) });
+}
diff --git a/challenge-124/feng-chang/raku/ch-1.raku b/challenge-124/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..b4523b9220
--- /dev/null
+++ b/challenge-124/feng-chang/raku/ch-1.raku
@@ -0,0 +1,9 @@
+#!/bin/env raku
+
+for '14322222341000100'.comb».UInt -> $c {
+ given $c {
+ when 0 { put ' ^' }
+ when 1 { put ' ^^^^^' }
+ default { put ' ' x ($c - 2), '^', ' ' x (13 - $c * 2), '^' }
+ }
+}
diff --git a/challenge-124/feng-chang/raku/ch-2.raku b/challenge-124/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..3a0d747519
--- /dev/null
+++ b/challenge-124/feng-chang/raku/ch-2.raku
@@ -0,0 +1,17 @@
+#!/bin/env raku
+
+sub MAIN(*@N) {
+ my UInt $num = @N.elems div 2;
+ my Int $sum = @N.sum;
+ my UInt $min = @N.combinations($num).map({ abs($sum - 2 * $_.sum) }).min;
+
+ @N.combinations($num).map({
+ if abs($sum - 2 * $_.sum) == $min {
+ put $_.join(' ');
+ put (@N (-) $_).keys.join(' ');
+ put ' = ' x 3;
+ }
+ });
+}
+
+# todo: when size is even, output should be cut to half
diff --git a/challenge-126/feng-chang/raku/ch-1.raku b/challenge-126/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..aa39eff4cb
--- /dev/null
+++ b/challenge-126/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $N) {
+ put (2..$N).grep(!*.comb.grep(1)).elems;
+}
diff --git a/challenge-126/feng-chang/raku/ch-2.raku b/challenge-126/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..e1dfc70f6e
--- /dev/null
+++ b/challenge-126/feng-chang/raku/ch-2.raku
@@ -0,0 +1,22 @@
+#!/bin/env raku
+
+sub is-mine(Array:D $game, Int:D $row, Int:D $col, UInt:D $max-row, UInt:D $max-col --> Bool:D) {
+ return False unless 0 ≤ $row < $max-row;
+ return False unless 0 ≤ $col < $max-col;
+ $game[$row;$col] eq 'x'
+}
+
+sub neibours(Array:D $game, UInt:D $row, UInt:D $col --> Str:D) {
+ $game[$row;$col] eq 'x' ?? 'x' !! (
+ ( 1, -1), ( 1, 0), ( 1, 1),
+ ( 0, -1), ( 0, 1),
+ (-1, -1), (-1, 0), (-1, 1)
+ ).map({ is-mine($game, $row + .[0], $col + .[1], $game.elems, $game[0].elems) }).grep(?*).elems.Str
+}
+
+sub MAIN(Str:D $f where $f.IO.e = 'input.txt') {
+ my Array $game = $f.IO.lines».comb.Array;
+ for ^$game.elems -> $row {
+ put (^$game[0].elems).map({ neibours($game, $row, .[0]) }).join(' ');
+ }
+}
diff --git a/challenge-126/feng-chang/raku/input.txt b/challenge-126/feng-chang/raku/input.txt
new file mode 100644
index 0000000000..c7dd9f6980
--- /dev/null
+++ b/challenge-126/feng-chang/raku/input.txt
@@ -0,0 +1,5 @@
+x***x*xxxx
+*********x
+****x*x*x*
+***xx*****
+x***x****x
diff --git a/challenge-128/feng-chang/raku/ch-1.raku b/challenge-128/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..367dbb470d
--- /dev/null
+++ b/challenge-128/feng-chang/raku/ch-1.raku
@@ -0,0 +1,17 @@
+#!/bin/env raku
+
+my method mat-size(List:D $coords where *.elems() == 4: --> UInt:D) {
+ ($coords[2] - $coords[0] + 1) * ($coords[3] - $coords[1] + 1)
+}
+
+sub MAIN(Str:D $f where *.IO.e = 'input.txt') {
+ my Array @mat .= push($_.comb.Array) for $f.IO.lines;
+
+ my @A = (^@mat.elems X ^@mat[0].elems X ^@mat.elems X ^@mat[0].elems)
+ .grep({ .[2] > .[0] and .[3] > .[1] })
+ .grep({ @mat[.[0] .. .[2]; .[1] .. .[3]].all == 0 });
+ my $max-size = @A.map(*.&mat-size).max;
+
+ put "max size: $max-size";
+ put @A.grep(*.&mat-size == $max-size).join("\n");
+}
diff --git a/challenge-128/feng-chang/raku/ch-2.raku b/challenge-128/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..1050c46bfc
--- /dev/null
+++ b/challenge-128/feng-chang/raku/ch-2.raku
@@ -0,0 +1,22 @@
+#!/bin/env raku
+
+subset TimeStr of Str where { $^s.match(/^ \d\d ':' \d\d $/) };
+
+my method mytime(TimeStr:D $t: --> DateTime:D) {
+ state Date $date = Date.new(now);
+ my ($hour, $minute) = $t.split(':');
+
+ DateTime.new(:$date, :$hour, :$minute)
+}
+
+sub MAIN(Str:D $f where *.IO.e = 'times.txt') {
+ my @lines = $f.IO.lines;
+ my @arrivals = @lines[0].words».&mytime;
+ my @departures = @lines[1].words».&mytime;
+
+ (|@arrivals, |@departures).map(-> $t {
+ (^@arrivals).grep(-> $i {
+ @arrivals[$i] ≤ $t ≤ @departures[$i]
+ }).elems
+ }).max.put;
+}
diff --git a/challenge-128/feng-chang/raku/in02.txt b/challenge-128/feng-chang/raku/in02.txt
new file mode 100644
index 0000000000..f8c64d269a
--- /dev/null
+++ b/challenge-128/feng-chang/raku/in02.txt
@@ -0,0 +1,3 @@
+0011
+0001
+0010
diff --git a/challenge-128/feng-chang/raku/input.txt b/challenge-128/feng-chang/raku/input.txt
new file mode 100644
index 0000000000..11c961ce70
--- /dev/null
+++ b/challenge-128/feng-chang/raku/input.txt
@@ -0,0 +1,3 @@
+100010
+110001
+100000
diff --git a/challenge-128/feng-chang/raku/times.txt b/challenge-128/feng-chang/raku/times.txt
new file mode 100644
index 0000000000..3bdd72d4d3
--- /dev/null
+++ b/challenge-128/feng-chang/raku/times.txt
@@ -0,0 +1,2 @@
+11:20 14:30
+11:50 15:00
diff --git a/challenge-128/feng-chang/raku/tm02.txt b/challenge-128/feng-chang/raku/tm02.txt
new file mode 100644
index 0000000000..a8ce4a8d1d
--- /dev/null
+++ b/challenge-128/feng-chang/raku/tm02.txt
@@ -0,0 +1,2 @@
+10:20 11:00 11:10 12:20 16:20 19:00
+10:30 13:20 12:40 12:50 20:20 21:20
diff --git a/challenge-132/feng-chang/raku/ch-1.raku b/challenge-132/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..cfdc079760
--- /dev/null
+++ b/challenge-132/feng-chang/raku/ch-1.raku
@@ -0,0 +1,11 @@
+#!/bin/env raku
+
+my method dstr(Date:D $dt: --> Str:D) {
+ $dt.Str.trans('-' => '/')
+}
+
+sub MAIN(Str:D $birth-date-str) {
+ my Date \birth-date = $birth-date-str.trans('/' => '-').Date;
+ my UInt \age = now.Date - birth-date;
+ put "{ (birth-date - age).&dstr }, { (now.Date + age).&dstr }";
+}
diff --git a/challenge-133/feng-chang/raku/ch-1.raku b/challenge-133/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..1322a40a06
--- /dev/null
+++ b/challenge-133/feng-chang/raku/ch-1.raku
@@ -0,0 +1,17 @@
+#!/bin/env raku
+
+my method sqrt(UInt:D \N: --> UInt:D) {
+ my UInt $m;
+ my UInt $n = N;
+
+ repeat {
+ $m = $n;
+ $n = ($m + N div $m) div 2;
+ } while $n < $m;
+
+ $m
+}
+
+sub MAIN(UInt:D \N where * > 0) {
+ put N.&sqrt;
+}
diff --git a/challenge-133/feng-chang/raku/ch-2.raku b/challenge-133/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..0f63b31841
--- /dev/null
+++ b/challenge-133/feng-chang/raku/ch-2.raku
@@ -0,0 +1,28 @@
+#!/bin/env raku
+
+sub facts(UInt:D \N where * > 1 --> Hash:D) {
+ my Int $m = N;
+ my Hash $F;
+
+ for (^∞).grep: *.is-prime -> $p {
+ while ($m %% $p) {
+ ++$F{$p};
+ $m div= $p;
+ }
+
+ last if $m < $p * $p;
+
+ LAST { ++$F{$m} if $m > 1 }
+ }
+
+ $F
+}
+
+sub is-smith-number(UInt:D \N --> Bool:D) {
+ return False if N.is-prime;
+
+ my Hash $F = facts(N);
+ N.comb.sum == $F.keys.map({ $_.comb.sum * $F{$_} }).sum
+}
+
+put (2..∞).grep({ is-smith-number($_) })[^10];
diff --git a/challenge-134/feng-chang/raku/ch-1.raku b/challenge-134/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..2808b4aa92
--- /dev/null
+++ b/challenge-134/feng-chang/raku/ch-1.raku
@@ -0,0 +1,3 @@
+#!/bin/env raku
+
+put (1_023_000_000 .. ∞).grep(*.comb.sort.unique.elems == 10)[^10];
diff --git a/challenge-134/feng-chang/raku/ch-2.raku b/challenge-134/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..9e565720a9
--- /dev/null
+++ b/challenge-134/feng-chang/raku/ch-2.raku
@@ -0,0 +1,22 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D \m, UInt:D \n) {
+ my @widths = (1..n)».&{ $_*m }».chars;
+ my %terms;
+
+ put 'x'.fmt("%{ m.chars }s"),
+ ' |',
+ (1..n)».&{ $_.fmt(" %{ @widths[$_-1] }d") }.join;
+ put '-' x m.chars,
+ '-+',
+ '-' x (@widths.sum + n);
+
+ for 1..m -> $row {
+ put $row.fmt("%{ m.chars }d"),
+ ' |',
+ (1..n)».&{ my $i = $_*$row; ++%terms{$i}; $i.fmt(" %{ @widths[$_-1] }d") }.join;
+ }
+
+ put "\nDistinct Terms: ", %terms.keys».Int.sort.join(', ');
+ put 'Count: ', %terms.keys.elems;
+}
diff --git a/challenge-135/feng-chang/raku/ch-1.raku b/challenge-135/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..4cc6c2919c
--- /dev/null
+++ b/challenge-135/feng-chang/raku/ch-1.raku
@@ -0,0 +1,15 @@
+#!/bin/env raku
+
+=begin usage
+
+ ./ch-1.raku -- -1234
+
+=end usage
+
+sub MAIN(Int:D $N) {
+ given abs($N) {
+ when $_.chars %% 2 { put 'even number of digits'; exit }
+ when $_.chars < 3 { put 'too short'; exit }
+ default { put $_.substr($_.chars div 2 - 1, 3) }
+ }
+}
diff --git a/challenge-135/feng-chang/raku/ch-2.raku b/challenge-135/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..bc0c1f3da3
--- /dev/null
+++ b/challenge-135/feng-chang/raku/ch-2.raku
@@ -0,0 +1,19 @@
+#!/bin/env raku
+
+my method digit-value(Str:D $d where *.chars == 1 :) {
+ return $d.Int if '0' le $d le '9';
+ return $d.ord - 'A'.ord if 'A' le $d le 'Z';
+ die 'wrong digit: ', $d;
+}
+
+sub check-digit(Str:D $sedol where *.chars == 6 --> UInt:D) {
+ state @weights = 1, 3, 1, 7, 3, 9, 1;
+ my @digits = $sedol.comb;
+
+ 10 - (^6)».&{ @digits[$_].&digit-value * @weights[$_] }.sum % 10
+}
+
+sub MAIN(Str:D $S where *.chars == 7) {
+ my Str $s = uc($S);
+ put +so check-digit($s.substr(0, 6)) == $s.substr(6, 1).Int;
+}
diff --git a/challenge-136/feng-chang/raku/ch-1.raku b/challenge-136/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..c1cc9c1c7e
--- /dev/null
+++ b/challenge-136/feng-chang/raku/ch-1.raku
@@ -0,0 +1,9 @@
+#!/bin/env raku
+
+multi sub is-two-friendly(0) { True }
+multi sub is-two-friendly(2) { True }
+multi sub is-two-friendly(UInt:D \n) { n %% 2 and is-two-friendly(n div 2) }
+
+sub MAIN(UInt:D \m, UInt:D \n) {
+ put +is-two-friendly(m gcd n);
+}
diff --git a/challenge-136/feng-chang/raku/ch-2.raku b/challenge-136/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..418370329a
--- /dev/null
+++ b/challenge-136/feng-chang/raku/ch-2.raku
@@ -0,0 +1,11 @@
+#!/bin/env raku
+
+my @fibo = 1, 2, * + * ... *;
+
+sub fibo-floor(UInt:D \n --> UInt:D) {
+ (^n).grep({ @fibo[$_] ≤ n }).max
+}
+
+sub MAIN(UInt:D \n) {
+ put @fibo[0 .. fibo-floor(n)].combinations.grep(*.sum == n).elems;
+}
diff --git a/challenge-137/feng-chang/perl/ch-1.pl b/challenge-137/feng-chang/perl/ch-1.pl
new file mode 100755
index 0000000000..c4fdf11502
--- /dev/null
+++ b/challenge-137/feng-chang/perl/ch-1.pl
@@ -0,0 +1,12 @@
+#!/bin/env perl
+
+use Date::Manip;
+
+my @years = grep { UnixDate("$_-12-31", '%W') == 53 } 1900..2100;
+
+my $first = 1;
+while (@years) {
+ $first ? $first = 0 : print ",\n";
+ print join ', ', splice @years, 0, 5;
+}
+print "\n";
diff --git a/challenge-137/feng-chang/raku/ch-1.raku b/challenge-137/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..b0de7b2725
--- /dev/null
+++ b/challenge-137/feng-chang/raku/ch-1.raku
@@ -0,0 +1,7 @@
+#!/bin/env raku
+
+put (1900..2100)
+ .grep({ Date("$_-12-31").week[1] == 53 })
+ .rotor(5, :partial)
+ .map({ $_.join(', ') })
+ .join(",\n");
diff --git a/challenge-137/feng-chang/raku/ch-2.raku b/challenge-137/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..7239d2cdb2
--- /dev/null
+++ b/challenge-137/feng-chang/raku/ch-2.raku
@@ -0,0 +1,21 @@
+#!/bin/env raku
+
+sub is-palindrome(UInt:D $n --> Bool:D) { $n.flip == $n }
+
+sub is-lynchel(UInt:D $n --> Bool:D) {
+ my UInt $m = $n;
+ my UInt $cnt;
+
+ repeat {
+ return False if is-palindrome($m);
+
+ $m += $m.flip;
+ ++$cnt;
+ } while $cnt < 500;
+
+ ! is-palindrome($m)
+}
+
+sub MAIN(UInt:D $n) {
+ put +is-lynchel($n);
+}
diff --git a/challenge-138/feng-chang/raku/ch-1.raku b/challenge-138/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..77b9791438
--- /dev/null
+++ b/challenge-138/feng-chang/raku/ch-1.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+sub MAIN(UInt:D $year where 1000 ≤ * ≤ 9999) {
+ put ("$year-01-01".Date .. "$year-12-31".Date)».day-of-week.grep(0 < * < 6).elems;
+}
diff --git a/challenge-138/feng-chang/raku/ch-2.raku b/challenge-138/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..a342d06c1c
--- /dev/null
+++ b/challenge-138/feng-chang/raku/ch-2.raku
@@ -0,0 +1,23 @@
+#!/bin/env raku
+
+sub combo(UInt:D $N, UInt:D $pat --> Array:D) {
+ my @digits = $N.comb».UInt;
+ my UInt $n = @digits.shift;
+ my @splits;
+
+ for @digits Z $pat.fmt('%0' ~ $N.chars-1 ~ 'b').comb».UInt -> ($d, $j) {
+ if ?$j {
+ @splits.push($n);
+ $n = $d;
+ } else {