aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-138/conor-hoekstra/ch-01.apl8
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-138/conor-hoekstra/ch-01.apl b/challenge-138/conor-hoekstra/ch-01.apl
new file mode 100644
index 0000000000..a78b3324c0
--- /dev/null
+++ b/challenge-138/conor-hoekstra/ch-01.apl
@@ -0,0 +1,8 @@
+splitNumber ← {
+ n ← ≢⍕⍵ ⍝ # of digits
+ m ← 2(⊥⍣¯1)(¯1∘++⍳)2*¯1+n ⍝ masks
+ p ← (↓⍉m)⊂¨⊂⍕⍵ ⍝ partitions
+ ∨/(⍵*0.5)={+/⍎¨⍵}¨p
+}
+
+splitNumber ¨ 81 9801 36 ⍝ 1 1 0