diff options
| -rwxr-xr-x | challenge-171/2colours/raku/ch-1.raku | 12 | ||||
| -rwxr-xr-x | challenge-171/2colours/raku/ch-2.raku | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/challenge-171/2colours/raku/ch-1.raku b/challenge-171/2colours/raku/ch-1.raku new file mode 100755 index 0000000000..f2e0dcc88d --- /dev/null +++ b/challenge-171/2colours/raku/ch-1.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku + +sub divisors($num) { + my @small-divisors = (1 .. sqrt $num).grep: $num %% *; + (|@small-divisors, |($num <<div<< @small-divisors )).Set +} + +1, 3 ... * andthen + .grep: { .&divisors.keys.sum > 2 * $_ } andthen + .head: 20 andthen + .join: ', ' andthen + .say; diff --git a/challenge-171/2colours/raku/ch-2.raku b/challenge-171/2colours/raku/ch-2.raku new file mode 100755 index 0000000000..e767caecd7 --- /dev/null +++ b/challenge-171/2colours/raku/ch-2.raku @@ -0,0 +1,7 @@ +#!/usr/bin/env raku + +sub compose(&f, &g) { + sub (|args) { f(g(|args)) } +} + +[* * 3, &infix:<+>].reduce(&compose)(3, 4).say;
\ No newline at end of file |
