From fe7a5caa41d6d83eafbe557432038ba80c77e8a7 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Tue, 13 Oct 2020 09:31:11 +0100 Subject: Challenge 1 --- challenge-082/simon-proctor/raku/ch-1.raku | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 challenge-082/simon-proctor/raku/ch-1.raku 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 %% * ) +} -- cgit