-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path47.py
57 lines (52 loc) · 929 Bytes
/
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
# NOT EVEN REMOTELY EFFICIENT
import math
def is_prime(n):
for i in range(2,int(math.sqrt(n)+1)):
if n%i==0:
return False
return True
def unique_prime_factors(n):
factors = list()
primes = [2,3]
for i in range(2,n):
divisible = True
while divisible:
if n%i==0:
if not i in factors:
factors.append(i)
n /= i
else:
divisible = False
else:
continue
return factors
i = 1000
while True:
if not is_prime(i):
print(i)
if len(unique_prime_factors(i))==4:
if not is_prime(i+1):
if len(unique_prime_factors(i+1))==4:
if not is_prime(i+2):
if len(unique_prime_factors(i+2))==4:
if not is_prime(i+3):
if len(unique_prime_factors(i+3))==4:
print i
quit()
else:
i+=4
else:
i+=4
else:
print i
i+=3
else:
i+=3
else:
i+=2
else:
i+=2
else:
i+=1
else:
i+=1