Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Created July 21, 2021 15:46
Show Gist options
  • Select an option

  • Save igorvanloo/63373b42130087677c8a2a9f3add0284 to your computer and use it in GitHub Desktop.

Select an option

Save igorvanloo/63373b42130087677c8a2a9f3add0284 to your computer and use it in GitHub Desktop.
Problem 23
def Divisors(x):
divisors = []
for i in range(1,int(math.sqrt(x))+1):
if x % i == 0:
divisors.append(i)
if i != int(x/i):
divisors.append(int(x/i))
divisors.remove(x)
return sum(set(divisors))
def compute():
abundantnums = []
for x in range(1,28123 + 1):
if x < Divisors(x):
abundantnums.append(x)
array = [True]*28124
for y in range(len(abundantnums)):
for z in range(y, len(abundantnums)):
if abundantnums[y]+abundantnums[z] < 28124:
array[abundantnums[y]+abundantnums[z]] = False
return sum([i for i in range(len(array)) if array[i]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment