diff options
| author | Andrew Shitov <andy@shitov.ru> | 2021-08-16 22:35:18 +0200 |
|---|---|---|
| committer | Andrew Shitov <andy@shitov.ru> | 2021-08-16 22:35:18 +0200 |
| commit | b0257db0d734f63a09779995ebedf01f7c9b2ebe (patch) | |
| tree | 2998a20f0d02fa55b93268cde14555ffbb76fbd8 /challenge-126 | |
| parent | a9715dfe351c0772fd7068fb3b701d03a26f2087 (diff) | |
| download | perlweeklychallenge-club-b0257db0d734f63a09779995ebedf01f7c9b2ebe.tar.gz perlweeklychallenge-club-b0257db0d734f63a09779995ebedf01f7c9b2ebe.tar.bz2 perlweeklychallenge-club-b0257db0d734f63a09779995ebedf01f7c9b2ebe.zip | |
Week 126, task 1 by ash
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; |
