-
Notifications
You must be signed in to change notification settings - Fork 0
/
gauss_init2.py
70 lines (33 loc) · 1.05 KB
/
gauss_init2.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
58
59
60
61
62
63
64
65
66
67
#GAUSSIAN INTEGER
import cmath as cm
import sys
final_div_sum = [0]
sum_divi = 0
n = sys.maxint(raw_input( ))
divi = [1]
def complex_divisor(divi,n,k):
for i in range(1,n+1):
for l in range(1,n+1):
divi = [1]
for i in range(2,l+1): # real valued factors
if l%i == 0:
divi.append(i)
print divi #comment this line out
k = int(l**0.5)
# for i in range(1,k+1):
# for j in range(1,k+1):
# if i == j and (i and j)!= 1:
# if sys.maxfloat(i)%(sys.maxfloat(i**2 + j**2)/sys.maxfloat(l)) == 0: # a check for common factors within the gaussian integer\
# divi.append(complex(i,j))
# divi.append(complex(i,-j))
# if(l%(i**2 + j**2) == 0):
# divi.append(complex(i,j))
# divi.append(complex(i,-j))
complex_divisor(divi,k)
#comment these 2 lines out
# print "%d ->" % l
print divi
sum_divi = sum(list(divi))
final_div_sum.append(sys.maxint(sum_divi.real))
#print final_div_sum
print sum(list(final_div_sum))