summaryrefslogtreecommitdiff
path: root/25_2020.py
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-06-15 22:20:32 -0600
committerJack Sangdahl <[email protected]>2024-06-15 22:20:32 -0600
commit8e313e2614c7a0fe5af924febdbacc650e33835e (patch)
tree63426b6942ceebe17708140c972a7d7451bd2f74 /25_2020.py
downloadaoc-8e313e2614c7a0fe5af924febdbacc650e33835e.tar.gz
aoc-8e313e2614c7a0fe5af924febdbacc650e33835e.zip
intial
Diffstat (limited to '25_2020.py')
-rw-r--r--25_2020.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/25_2020.py b/25_2020.py
new file mode 100644
index 0000000..6a20d11
--- /dev/null
+++ b/25_2020.py
@@ -0,0 +1,22 @@
+import re
+import sys
+
+
+def transform(x, sz):
+ return pow(x, sz, 20201227)
+
+
+k1, k2 = [int(x) for x in sys.stdin.read().strip().split("\n")]
+# k1,k2 = 5764801,17807724
+
+l1 = 0
+while transform(7, l1) != k1:
+ l1 += 1
+
+l2 = 0
+while transform(7, l2) != k2:
+ l2 += 1
+
+encryption = transform(k1, l2)
+assert encryption == transform(k2, l1)
+print(encryption)