diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-01-13 10:48:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-13 10:48:02 +0000 |
| commit | 3aaab5cee8ebf950882b5561c07f00dab83dc4bf (patch) | |
| tree | 6a78153f9b2686e62e9066b870213412d0f82e65 | |
| parent | d26eb6a65ba81336730af470fb240d491e6970a7 (diff) | |
| parent | cf5faf46272ecba05f23c25b07100fed810d8fa4 (diff) | |
| download | perlweeklychallenge-club-3aaab5cee8ebf950882b5561c07f00dab83dc4bf.tar.gz perlweeklychallenge-club-3aaab5cee8ebf950882b5561c07f00dab83dc4bf.tar.bz2 perlweeklychallenge-club-3aaab5cee8ebf950882b5561c07f00dab83dc4bf.zip | |
Merge pull request #5512 from codereport/master
Week 147 solutions in APL
| -rw-r--r-- | challenge-147/conor-hoekstra/apl/ch-1.apl | 5 | ||||
| -rw-r--r-- | challenge-147/conor-hoekstra/apl/ch-2.apl | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/challenge-147/conor-hoekstra/apl/ch-1.apl b/challenge-147/conor-hoekstra/apl/ch-1.apl new file mode 100644 index 0000000000..7048c0a180 --- /dev/null +++ b/challenge-147/conor-hoekstra/apl/ch-1.apl @@ -0,0 +1,5 @@ +isPrime ← 2≥(≢∘∪⍳∨⊢) +∊{⍵/⍨∧/isPrime∘⍎¨,\⍕⍵}¨⍳135 + +⍝ Output +1 2 3 5 7 11 13 17 19 23 29 31 37 53 59 71 73 79 113 131 diff --git a/challenge-147/conor-hoekstra/apl/ch-2.apl b/challenge-147/conor-hoekstra/apl/ch-2.apl new file mode 100644 index 0000000000..33d4f1f43d --- /dev/null +++ b/challenge-147/conor-hoekstra/apl/ch-2.apl @@ -0,0 +1,6 @@ +pentagon ← {2÷⍨⍵ׯ1+3×⍵} +isPentagon ← {(⌊=⊢){⍵/⍨0<⍵}6÷⍨1(+,-).5*⍨1+24×⍵} +p10000 ← pentagon ⍳10000 +is ← ⍸⊃∘.(+∧⍥isPentagon|∘-)⍨p10000 + +is⌷p10000 ⍝ 1560090 7042750 |
