-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheuler_23.py
More file actions
36 lines (29 loc) · 816 Bytes
/
Copy patheuler_23.py
File metadata and controls
36 lines (29 loc) · 816 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
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
ceiling = 28123
def abundant_numbers(number):
divisors = factors(number)
summer = sum(divisors)-number
if number < summer:
return number
return 0
def euler():
abundant = []
for i in range(1,28124):
abundant.append(abundant_numbers(i))
return abundant
euler_problem = euler()
eul = []
for i in euler_problem:
if i > 0:
eul.append(i)
eu = list(itertools.combinations_with_replacement(eul,2))
summer = []
for i in eul:
if sum(i) < ceiling:
summer.append(sum(i))
my_range = range(1,28124)
to_remove = set(summer)
not_sum_of_abundant = [x for x in my_range if x not in to_remove]
sum(not_sum_of_abundant) = 4179871