Created
September 16, 2011 16:57
-
-
Save msalahi/1222544 to your computer and use it in GitHub Desktop.
MuradWeek7Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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