-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday25.py
More file actions
47 lines (29 loc) · 691 Bytes
/
day25.py
File metadata and controls
47 lines (29 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def calc_ls(num, expected):
val = 1
loopsize = 0
while True:
val = val * num
rem = val % 20201227
val = rem
loopsize += 1
if val == expected:
break
return loopsize
def transform(num, ls):
val = 1
for i in range(ls):
val = val*num
val = val % 20201227
return val
def task1():
inp = [5764801, 17807724]
inp = [14222596, 4057428]
ls1 = calc_ls(7, inp[0])
ls2 = calc_ls(7, inp[1])
ek1 = transform(inp[0], ls2)
ek2 = transform(inp[1], ls1)
assert ek1 == ek2
print(ls1, ls2)
print('answer1: %s' % ek1)
breakpoint()
task1()