diff options
Diffstat (limited to 'challenge-126')
| -rw-r--r-- | challenge-126/ash/README | 1 | ||||
| -rw-r--r-- | challenge-126/ash/raku/ch-1.raku | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/challenge-126/ash/README b/challenge-126/ash/README new file mode 100644 index 0000000000..318b1bfb41 --- /dev/null +++ b/challenge-126/ash/README @@ -0,0 +1 @@ +Solutions by Andrew Shitov diff --git a/challenge-126/ash/raku/ch-1.raku b/challenge-126/ash/raku/ch-1.raku new file mode 100644 index 0000000000..d1c42c4796 --- /dev/null +++ b/challenge-126/ash/raku/ch-1.raku @@ -0,0 +1,18 @@ +sub count($n) { + my @items = (2..$n).grep: * !~~ /1/; + if @items { + if @items.elems == 1 { + say "There is 1 number between 1 and $n that doesn't contain digit 1."; + } + else { + say "There are {+@items} numbers between 1 and $n that don't contain digit 1."; + } + + say @items.join(', ') ~ '.'; + } + else { + say "There are no numbers between 1 and $n that contain no digit 1."; + } +} + +.&count for 5, 15, 25; |
