Skip to content

Commit

Permalink
Updated Euler problem 21 sol1.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SandersLin authored and tapaswenipathak committed Apr 19, 2019
1 parent a170997 commit a91f0e7
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions project_euler/problem_21/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,7 @@ def sum_of_divisors(n):
total += i + n//i
elif i == sqrt(n):
total += i

return total-n

sums = []
total = 0

for i in xrange(1, 10000):
n = sum_of_divisors(i)

if n < len(sums):
if sums[n-1] == i:
total += n + i

sums.append(n)

print(total)
total = [i for i in range(1,10000) if sum_of_divisors(sum_of_divisors(i)) == i and sum_of_divisors(i) != i]
print(sum(total))

0 comments on commit a91f0e7

Please sign in to comment.