aboutsummaryrefslogtreecommitdiff
path: root/challenge-082
diff options
context:
space:
mode:
authorKang-min Liu <gugod@gugod.org>2020-10-12 21:38:03 +0900
committerKang-min Liu <gugod@gugod.org>2020-10-12 21:38:03 +0900
commit34ffa543b02e35a80e91461bef167732eb224704 (patch)
treeed2aaf1e18341d10772660c6ac37a732a72286ac /challenge-082
parent2e7fb5ec844f60c121ef26d50e6b7f24b8849780 (diff)
downloadperlweeklychallenge-club-34ffa543b02e35a80e91461bef167732eb224704.tar.gz
perlweeklychallenge-club-34ffa543b02e35a80e91461bef167732eb224704.tar.bz2
perlweeklychallenge-club-34ffa543b02e35a80e91461bef167732eb224704.zip
a solution of 082.1 in Raku
Diffstat (limited to 'challenge-082')
-rw-r--r--challenge-082/gugod/raku/ch-1.raku10
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-082/gugod/raku/ch-1.raku b/challenge-082/gugod/raku/ch-1.raku
new file mode 100644
index 0000000000..f2d918b47b
--- /dev/null
+++ b/challenge-082/gugod/raku/ch-1.raku
@@ -0,0 +1,10 @@
+#!/usr/bin/env raku
+
+sub MAIN (Int $M, Int $N) {
+ my ($a, $b) = ($M, $N).sort;
+ say common-factors($a, $b);
+}
+
+sub common-factors (Int $a, Int $b) {
+ (1, 2..$a/2, $a).flat.grep(-> $n { 0 == $a % $n == $b % $n });
+}