-
Notifications
You must be signed in to change notification settings - Fork 0
/
23.py
41 lines (35 loc) · 785 Bytes
/
23.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
#!/usr/bin/env python
# coding=utf-8
import math
def is_abundant(n):
divisors = []
for i in range(1,int(math.sqrt(n))+1):
if n%i == 0:
#print i
divisors.append(i)
divisors.append(n/i)
if n/i==i:
divisors.remove(i)
sum = 0
for i in divisors:
sum+=i
divisorssum = sum - n
#print divisorssum
if divisorssum>n:
return 1
else:
return 0
#print is_abundant(4)
def not_abundant_sum(n):
for i in range(1,n/2+1):
if is_abundant(i) and is_abundant(n-i):
print i,n-i
return 0
return 1
#print not_abundant_sum(8)
sum = 0
for i in range(1,28124):
if not_abundant_sum(i):
print i
sum+=i
print sum