Example #1
0
#!/usr/bin/env python

from math_tools import proper_factors
"""https://projecteuler.net/problem=23"""
if __name__ == '__main__':
    abundant = []

    for n in range(1, 28124):
        if sum(proper_factors(n)) > n:
            abundant.append(n)

    numbers = set(range(1, 28124))

    for k, n in enumerate(abundant):
        for m in abundant[k:]:
            numbers.discard(m + n)

    print(sum(numbers))
Example #2
0
#!/usr/bin/env python

from math_tools import proper_factors
"""https://projecteuler.net/problem=32"""
if __name__ == '__main__':
    result = 0

    for n in range(1, 10000):
        for a in proper_factors(n):
            if "".join(sorted(str(a) + str(n / a) + str(n))) == "123456789":
                result += n
                break

    print(result)
Example #3
0
def proper_factors_sum(num):
    return sum(proper_factors(num))
Example #4
0
def proper_factors_sum(num):
	return sum(proper_factors(num))
Example #5
0
#!/usr/bin/env python

from math_tools import proper_factors


"""https://projecteuler.net/problem=23"""
if __name__ == '__main__':
	abundant = []

	for n in range(1, 28124):
		if sum(proper_factors(n)) > n:
			abundant.append(n)

	numbers = set(range(1, 28124))

	for k, n in enumerate(abundant):
	 	for m in abundant[k:]:
	 		numbers.discard(m + n)
			
	print(sum(numbers))
Example #6
0
#!/usr/bin/env python

from math_tools import proper_factors


"""https://projecteuler.net/problem=32"""
if __name__ == '__main__':
	result = 0

	for n in range(1, 10000):
		for a in proper_factors(n):
			if "".join(sorted(str(a) + str(n / a) + str(n))) == "123456789":
				result += n
				break

	print(result)