diff options
| author | chirvasitua <stuart-little@users.noreply.github.com> | 2021-06-07 07:58:30 -0400 |
|---|---|---|
| committer | chirvasitua <stuart-little@users.noreply.github.com> | 2021-06-07 07:58:30 -0400 |
| commit | e1ea4c07d0bba3d8402cbe2a06527f531369a086 (patch) | |
| tree | c3bdf529cd806476767521dba111305e70c04e55 /challenge-116 | |
| parent | 4830b1d50fd610eb2424fe284cb48a2795e0478c (diff) | |
| download | perlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.tar.gz perlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.tar.bz2 perlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.zip | |
1st commit on 116_raku
Diffstat (limited to 'challenge-116')
| -rwxr-xr-x | challenge-116/stuart-little/raku/ch-1.p6 | 10 | ||||
| -rwxr-xr-x | challenge-116/stuart-little/raku/ch-2.p6 | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-116/stuart-little/raku/ch-1.p6 b/challenge-116/stuart-little/raku/ch-1.p6 new file mode 100755 index 0000000000..b86a35a058 --- /dev/null +++ b/challenge-116/stuart-little/raku/ch-1.p6 @@ -0,0 +1,10 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <number> + +sub consecSplit(Str $s) { + return (1..$s.chars).map({ $s.substr(0,$_) }).map({ (0..$s.chars).map(-> $i { $_.Int + $i }) }).map(-> @a {(0..^@a.elems).map(-> $ix {@a.[0..$ix]})}).map(-> @aa {@aa.first({ $_.join("").chars >= $s.chars })}).first({ $_.join("") eq $s }) +} + +consecSplit(@*ARGS[0]).say diff --git a/challenge-116/stuart-little/raku/ch-2.p6 b/challenge-116/stuart-little/raku/ch-2.p6 new file mode 100755 index 0000000000..de605be844 --- /dev/null +++ b/challenge-116/stuart-little/raku/ch-2.p6 @@ -0,0 +1,8 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <number> + +my $digSqSum = @*ARGS[0].comb.map(*.Int ** 2).sum; +($digSqSum.sqrt.Int ** 2 == $digSqSum).Int.say; + |
