diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2022-05-03 10:08:20 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2022-05-03 10:08:20 -0400 |
| commit | 9ae66bdecda2cfa192a1a5c0fece7d6b7c6394b8 (patch) | |
| tree | 5b8c9361e7ee1b1085d67bcedd948948a7a9c45c | |
| parent | b13444bb5307ad7c7051ace6031dd063bac3cc32 (diff) | |
| download | perlweeklychallenge-club-9ae66bdecda2cfa192a1a5c0fece7d6b7c6394b8.tar.gz perlweeklychallenge-club-9ae66bdecda2cfa192a1a5c0fece7d6b7c6394b8.tar.bz2 perlweeklychallenge-club-9ae66bdecda2cfa192a1a5c0fece7d6b7c6394b8.zip | |
Week 163 P2 in APL
| -rw-r--r-- | challenge-163/conor-hoekstra/ch-2.apl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-163/conor-hoekstra/ch-2.apl b/challenge-163/conor-hoekstra/ch-2.apl new file mode 100644 index 0000000000..834ff7f4a5 --- /dev/null +++ b/challenge-163/conor-hoekstra/ch-2.apl @@ -0,0 +1,27 @@ + summations ← {⊖⌽⍤1↑⍕¨¨⌽¨1↓{⍵,⍨⊂+\1↓⊃⍵}⍣(≢⍵)⊂⍵} + + ⍝ Tests + summations 1 2 3 4 5 +┌──┬──┬──┬──┬──┐ +│1 │2 │3 │4 │5 │ +├──┼──┼──┼──┼──┤ +│ │2 │5 │9 │14│ +├──┼──┼──┼──┼──┤ +│ │ │5 │14│28│ +├──┼──┼──┼──┼──┤ +│ │ │ │14│42│ +├──┼──┼──┼──┼──┤ +│ │ │ │ │42│ +└──┴──┴──┴──┴──┘ + summations 1 3 5 7 9 +┌──┬──┬──┬──┬──┐ +│1 │3 │5 │7 │9 │ +├──┼──┼──┼──┼──┤ +│ │3 │8 │15│24│ +├──┼──┼──┼──┼──┤ +│ │ │8 │23│47│ +├──┼──┼──┼──┼──┤ +│ │ │ │23│70│ +├──┼──┼──┼──┼──┤ +│ │ │ │ │70│ +└──┴──┴──┴──┴──┘
\ No newline at end of file |
