diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-08-23 05:49:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-23 05:49:42 +0100 |
| commit | df35ff0ae1f97a768f4365ac33aebffc0d331a6d (patch) | |
| tree | 777ae38e487f34b79f8a3728993c47e0d11858bc | |
| parent | 82fefdf42654dc10a8427f4668a1c19ea611456d (diff) | |
| parent | d2b0ce69bfd1c352717b2e5ef1944c59e643e8b0 (diff) | |
| download | perlweeklychallenge-club-df35ff0ae1f97a768f4365ac33aebffc0d331a6d.tar.gz perlweeklychallenge-club-df35ff0ae1f97a768f4365ac33aebffc0d331a6d.tar.bz2 perlweeklychallenge-club-df35ff0ae1f97a768f4365ac33aebffc0d331a6d.zip | |
Merge pull request #4769 from andemark/branch-for-challenge-126
Last minute change
| -rw-r--r-- | challenge-126/mark-anderson/raku/ch-1.raku | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/challenge-126/mark-anderson/raku/ch-1.raku b/challenge-126/mark-anderson/raku/ch-1.raku index c83b03f868..c2c267fb21 100644 --- a/challenge-126/mark-anderson/raku/ch-1.raku +++ b/challenge-126/mark-anderson/raku/ch-1.raku @@ -1,9 +1,9 @@ #!/usr/bin/env raku # The adjust function adjusts the number if it contains a 1 -# Examples: 111 is converted to 99 -# 901 is converted to 900 -# 2731515 is converted to 2730999 +# Examples: adjust(111) = 99 +# adjust(901) = 900 +# adjust(2731515) = 2730999 # The count-numbers function performs this equivalent algorithm: # For all digits, subtract 1 and multiply that by 9 raised to the @@ -49,7 +49,5 @@ sub adjust($N is copy) return $N if @a.elems == 1; # $N has no 1s @a.tail = 0 ~ 9 x @a.tail.chars; - - return +@a.tail unless @a.head; # first digit of $N is 1 return @a.join; } |
