def problem73a(): total = 0 from factorGenerating import genFactors for d in genFactors(12000): if d in [(1,)]: continue for n in genFactors(product(d)): r = product(n)/product(d) if relPrimeFromFactors(n,d) == 1 and r > 1/3 and r < 1/2: total += 1 return total
def problem231(): n = 20000000 c = 15000000 total = 1 for factor in genFactors(n): prod = product(factor) if n - c < prod <= n: total += sum(factor) if 1<= prod <= c: total -= sum(factor) return total