aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraecepoglu <aecepoglu@fastmail.fm>2022-11-22 00:30:14 +0000
committeraecepoglu <aecepoglu@fastmail.fm>2022-11-22 00:30:14 +0000
commit9c1529baa7f8ce527e83702a4877676cf66036d3 (patch)
tree9eabca8c01c5db52b1654ea9d215951dd50acab7
parent62cd59ab1bc620f0a9a621801645f61b2afba4fe (diff)
downloadperlweeklychallenge-club-9c1529baa7f8ce527e83702a4877676cf66036d3.tar.gz
perlweeklychallenge-club-9c1529baa7f8ce527e83702a4877676cf66036d3.tar.bz2
perlweeklychallenge-club-9c1529baa7f8ce527e83702a4877676cf66036d3.zip
wk 192, ch-1,2.bqn
-rw-r--r--challenge-192/aecepoglu/README2
-rw-r--r--challenge-192/aecepoglu/bqn/ch-1.bqn11
-rw-r--r--challenge-192/aecepoglu/bqn/ch-2.bqn15
3 files changed, 28 insertions, 0 deletions
diff --git a/challenge-192/aecepoglu/README b/challenge-192/aecepoglu/README
index ac1444b698..9e57c3a464 100644
--- a/challenge-192/aecepoglu/README
+++ b/challenge-192/aecepoglu/README
@@ -1 +1,3 @@
Solution by AhmetEmre
+
+Solved live on twitch.tv/slippygoat
diff --git a/challenge-192/aecepoglu/bqn/ch-1.bqn b/challenge-192/aecepoglu/bqn/ch-1.bqn
new file mode 100644
index 0000000000..6a3d34db78
--- /dev/null
+++ b/challenge-192/aecepoglu/bqn/ch-1.bqn
@@ -0,0 +1,11 @@
+# Two numbers (A, B) are their binary complements
+# They will sum up to a N: (A + B = N)
+# where N = (2⋆k)-1,
+# where k is the number of bits required to represent A
+#
+# So first we find how many bits are required (A in log_2 rounded up)
+# Then we find the value of N
+# And we subtract from N our A
+F←(⌈⌾(2⊸⋆⁼1⊸+))⊸-
+2 = F 5
+7 = F 8
diff --git a/challenge-192/aecepoglu/bqn/ch-2.bqn b/challenge-192/aecepoglu/bqn/ch-2.bqn
new file mode 100644
index 0000000000..ddd449cb2c
--- /dev/null
+++ b/challenge-192/aecepoglu/bqn/ch-2.bqn
@@ -0,0 +1,15 @@
+# Likely some group theory at play here
+# Given A, B, C
+# A->C ≡ {A->B, B->C}
+# But this doesn't help me with anything practical
+#
+#
+# Find the deviation
+# Apply effective diffs to it
+# (by decrementing positive vals and incrementing negative vals)
+# until solution found
+F←{G←{·‿x:0≠+´x?¯1‿x
+ ;n‿x: 𝕩+d⋈˜|-´/|d←-∊⊸××x}
+ ⊑ G •_while_ {n‿x:(n≥0)∧(∨´0≠x)} 0⋈ (≠⥊+´÷≠)⊸- 𝕩}
+4 = F 1‿0‿5
+¯1 = F 1‿0‿0