-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12.py
More file actions
50 lines (44 loc) · 809 Bytes
/
Copy path12.py
File metadata and controls
50 lines (44 loc) · 809 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
44
45
46
47
48
49
50
a = 10000000
k = range(2,a)
m = []
# generate primes
while len(k)>0:
i = k[0]
k = [g for g in k if g%k[0] != 0]
m.append(i)
if i**2 > a:
break
print m
# generate triangle numbers
x = range(1,40000)
triangle = []
for i in range(len(x)):
triangle.append(sum(x[:i]))
triangle = triangle[800:]
print triangle
# divison
powerbig = []
factorbig = []
for i in triangle:
j = 0
factor = []
power = []
while j <len(m):
g = m[j]
if g<i and i%g == 0:
k = 1
factor.append(g)
while i%g == 0:
k += 1
g = g**k
power.append(k-1)
j+=1
powerbig.append(power)
factorbig.append(factor)
for i in range(len(powerbig)):
powerbig[i] = [j+1 for j in powerbig[i]]
from numpy import prod
k=list(map(prod,powerbig))
print k
g=min([i for i in range(len(k)) if k[i] > 500])
print triangle[g]