From d2b0ce69bfd1c352717b2e5ef1944c59e643e8b0 Mon Sep 17 00:00:00 2001 From: Mark A Date: Sun, 22 Aug 2021 22:45:53 -0600 Subject: Last minute change --- challenge-126/mark-anderson/raku/ch-1.raku | 8 +++----- 1 file 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; } -- cgit