Beispiel #1
0
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]
Beispiel #2
0
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]
Beispiel #3
0
def isAbundant(x):
    return x < sum(prime.getFactors(x))