def numDivisors(N): factors = factorTrialDivision(N) return lu.product(lu.addOne(lu.listCount(factors)))
if prod > maxprod: maxprod = prod print maxprod ##################################################################### # Problem 12 if problem == 12: val = 0 for x in xrange(9,50000): # Find prime factors of n*(n-1)/2 numdiv = 0 if x % 2 == 0: factorx = pf.factorTrialDivision(x//2) factorx1 = pf.factorTrialDivision(x+1) factorx.extend(factorx1) numdiv = lu.product(lu.addOne(lu.listCount(factorx))) else: factorx = pf.factorTrialDivision(x) factorx1 = pf.factorTrialDivision((x+1)//2) factorx.extend(factorx1) numdiv = lu.product(lu.addOne(lu.listCount(factorx))) if (numdiv) >= 500: val = x break print nf.cumsum(val) ##################################################################### # Problem 13 # OK I cheated... thank you big number library of python if problem == 13: