From dfc224a2fa397213a0704759c2af59eac1cccda4 Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Mon, 16 Mar 2020 14:05:52 -0600 Subject: ch-1.p6 --- challenge-052/mark-anderson/raku/ch-1.p6 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 challenge-052/mark-anderson/raku/ch-1.p6 diff --git a/challenge-052/mark-anderson/raku/ch-1.p6 b/challenge-052/mark-anderson/raku/ch-1.p6 new file mode 100644 index 0000000000..1bbc8648fe --- /dev/null +++ b/challenge-052/mark-anderson/raku/ch-1.p6 @@ -0,0 +1,13 @@ +#!/usr/bin/env raku + +# I learned about polymod from Kevin Colyer's ch-2.p6 solution last week. +# I like that method for splitting up the number into its digits. + +sub MAIN($num1, $num2 where $num1 >= 100 < $num2 <= 999) { + for ($num1..$num2) -> $num { + my @digits = (+$num).polymod(10,10); + if (([-] @digits[0,1]).abs == ([-] @digits[1,2]).abs == 1) { + say $num; + } + } +} -- cgit