aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-147/conor-hoekstra/apl/ch-1.apl5
-rw-r--r--challenge-147/conor-hoekstra/apl/ch-2.apl6
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