diff options
| -rwxr-xr-x | challenge-109/feng-chang/raku/ch-1.raku | 2 | ||||
| -rwxr-xr-x | challenge-109/feng-chang/raku/ch-2.raku | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-109/feng-chang/raku/ch-1.raku b/challenge-109/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..0e3494f184 --- /dev/null +++ b/challenge-109/feng-chang/raku/ch-1.raku @@ -0,0 +1,2 @@ +#!/bin/env raku +(1..20).map({ (2..^$^a).grep($^a%%*).sum }).put; diff --git a/challenge-109/feng-chang/raku/ch-2.raku b/challenge-109/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..54d6c89ced --- /dev/null +++ b/challenge-109/feng-chang/raku/ch-2.raku @@ -0,0 +1,18 @@ +#!/bin/env raku + +sub tell-the-answer(@*a) { + my %h; + for 'a'..'g' Z ^7 -> ($c, $n) { + %h{$c} = @*a[$n]; + put "$c = { %h{$c} }"; + } + + put "Box 1: a + b = {%h<a>} + {%h<b>} = { %h<a> + %h<b> }"; + put "Box 2: b + c + d = {%h<b>} + {%h<c>} + {%h<d>} = { %h<b> + %h<c> + %h<d> }"; + put "Box 3: d + e + f = {%h<d>} + {%h<e>} + {%h<f>} = { %h<d> + %h<e> + %h<f> }"; + put "Box 4: f + g = {%h<f>} + {%h<g>} = { %h<f> + %h<g> }"; + + put ' - ' x 11; +} + +(1..7).permutations.grep({ .&tell-the-answer if .[0]+.[1] == .[1]+.[2]+.[3] == .[3]+.[4]+.[5] == .[5]+.[6] }); |
