diff options
| author | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-10-13 09:31:11 +0100 |
|---|---|---|
| committer | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-10-13 09:31:11 +0100 |
| commit | fe7a5caa41d6d83eafbe557432038ba80c77e8a7 (patch) | |
| tree | ed3e7a1ed66e0609d86b22aec39a925520383aa4 | |
| parent | 3de8c82d33415b7fcf11174d9fbf0c23a783c802 (diff) | |
| download | perlweeklychallenge-club-fe7a5caa41d6d83eafbe557432038ba80c77e8a7.tar.gz perlweeklychallenge-club-fe7a5caa41d6d83eafbe557432038ba80c77e8a7.tar.bz2 perlweeklychallenge-club-fe7a5caa41d6d83eafbe557432038ba80c77e8a7.zip | |
Challenge 1
| -rw-r--r-- | challenge-082/simon-proctor/raku/ch-1.raku | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-082/simon-proctor/raku/ch-1.raku b/challenge-082/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..3215cb071a --- /dev/null +++ b/challenge-082/simon-proctor/raku/ch-1.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku + +use v6; + +#| Given two positive integers print the common factors (not including the values themselves). +sub MAIN ( UInt $M, UInt $N ) { + say "({(fac($M) (&) fac($N)).keys.sort.join(', ')})" +} + +sub fac( UInt $v ) { + (1..^$v).grep( $v %% * ) +} |
