Skip to content

Instantly share code, notes, and snippets.

@msalahi
Created September 16, 2011 16:57
Show Gist options
  • Save msalahi/1222544 to your computer and use it in GitHub Desktop.
Save msalahi/1222544 to your computer and use it in GitHub Desktop.
MuradWeek7Solution
import math
def isAbundant(n):
div = 1
for i in range(2,int(math.sqrt(n))+1):
if n%i==0:
div += i if i==n/i else i+(n/i)
return True if div>n else False
def sumOfUniqueAbundantPairSums():
uniqueSums = []
total = 0
abundantNumbers = [n for n in xrange(1,28124) if isAbundant(n)]
return sum(set(a1+a2 for a1 in abundantNumbers for a2 in abundantNumbers if a1+a2<28124))
print sum(xrange(1,28124))-sumOfUniqueAbundantPairSums()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment