for divisor in divisors: if divisor < m or currentProduct * divisor > 2*upper: continue if validRecurse(divisors, usedDivisors+[divisor]): pass return False upper = 12000 nums = set(range(3, upper+1)) prodSums = {} i = 2 while i < upper: print i # divisors = factorize.multipleDivisors(i) divisors = set(factorize.divisors(i)) divisors.remove(1) validRecurse(list(divisors), []) # print nums i += 1 res = set() for k, v in prodSums.iteritems(): if k >= 2 and k <= upper: res.add(v) print res print sum(res)
def valid(n, p): divisors = factorize.divisors(n) return validRecurse(divisors, [], p)
for divisor in divisors: if divisor < m or currentProduct * divisor > 2 * upper: continue if validRecurse(divisors, usedDivisors + [divisor]): pass return False upper = 12000 nums = set(range(3, upper + 1)) prodSums = {} i = 2 while i < upper: print i # divisors = factorize.multipleDivisors(i) divisors = set(factorize.divisors(i)) divisors.remove(1) validRecurse(list(divisors), []) # print nums i += 1 res = set() for k, v in prodSums.iteritems(): if k >= 2 and k <= upper: res.add(v) print res print sum(res)