This commit is contained in:
Sebastian Seedorf
2020-12-30 19:39:33 +01:00
parent fc93f4a5e7
commit efc9d51f52
2 changed files with 21 additions and 0 deletions

2
day25/input.txt Normal file
View File

@@ -0,0 +1,2 @@
8458505
16050997

19
day25/part1.py Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env python3
c_pub, d_pub = [int(x.strip()) for x in open("input.txt")]
val = 1
less_loop, less_pub = None, None
for loop in range(1, 20201227):
val = (val*7) % 20201227
if val == c_pub:
less_loop, less_pub = loop, d_pub
break
elif val == d_pub:
less_loop, less_pub = loop, c_pub
break
val = 1
for _ in range(less_loop):
val = (val*less_pub) % 20201227
print(val)