예제 #1
0
파일: prob088.py 프로젝트: bfishbaum/euler
def allFactorSums(x):
    if (x not in dict1):
        if (pi.isPrime(x)):
            return [(x, 1)]
        else:
            total1 = []
            facts = pi.getFactors(x)[1:]
            for i in facts:
                for j in allFactorSums(x // i):
                    total1.append((i + j[0], 1 + j[1]))
                    total1.append((i + x // i, 2))
        dict1[x] = frozenset(total1)
    return dict1[x]
예제 #2
0
파일: prob088.py 프로젝트: bfishbaum/euler
def allFactorSums(x):
	if(x not in dict1):
		if(pi.isPrime(x)):
			return [(x,1)]
		else:
			total1 = []
			facts = pi.getFactors(x)[1:]
			for i in facts:
				for j in allFactorSums(x//i):
					total1.append((i+j[0],1+j[1]))
					total1.append((i+x//i,2))
		dict1[x] = frozenset(total1)
	return dict1[x]
예제 #3
0
def isAbundant(x):
    return x < sum(prime.getFactors(x))