コード例 #1
0
def getnfTypes(Upper):
	abundant = []
	perfect = []
	deficient = []
	for i in xrange(Upper):
		if i % 100 == 0:
			sys.stdout.write(".")
			sys.stdout.flush()
		if i % 1000 == 0:
			print i
		s = sum(pf.trialDivisionDivisors(i))
		if i < s:
			abundant.append(i)
		elif i == s:
			perfect.append(i)
		else:
			deficient.append(i)

	print "Done"
	return abundant, perfect, deficient
コード例 #2
0
def getDivisorsCached(N,Cache):
	if not N in Cache:
		Cache[N] = pf.trialDivisionDivisors(x)
	return Cache[N]