-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path47.py
57 lines (51 loc) · 1.01 KB
/
47.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def pf(n):
pfd = {}
while n % 2 == 0:
try:
pfd[2] += 1
except KeyError:
pfd[2] = 1
n //= 2
for i in range(3, int(n**0.5)+2, 2):
while n % i == 0:
try:
pfd[i] += 1
except KeyError:
pfd[i] = 1
n //= i
if n != 1:
pfd[n] = 1
return pfd
def d2s(d):
s = set()
for key in d:
s.add(key**d[key])
return s
i = 644
while True:
## sorry for hacky continues, but really speeds things up
a = pf(i)
if len(a) != 4:
i += 1
continue
b = pf(i+1)
if len(b) != 4:
i += 1
continue
c = pf(i+2)
if len(c) != 4:
i += 1
continue
d = pf(i+3)
if len(d) != 4:
i += 1
continue
a = d2s(a)
b = d2s(b)
c = d2s(c)
d = d2s(d)
if a.intersection(b, c, d) == set():
print(i)
print(a, b, c, d)
break
i += 1