本文整理匯總了Python中HelperFunctions.primeFactorization方法的典型用法代碼示例。如果您正苦於以下問題:Python HelperFunctions.primeFactorization方法的具體用法?Python HelperFunctions.primeFactorization怎麽用?Python HelperFunctions.primeFactorization使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HelperFunctions
的用法示例。
在下文中一共展示了HelperFunctions.primeFactorization方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: problem5
# 需要導入模塊: import HelperFunctions [as 別名]
# 或者: from HelperFunctions import primeFactorization [as 別名]
def problem5():
factors = mset()
for i in range(21):
pf = mset(hf.primeFactorization(i))
a = pf - factors
factors += a
b = list(factors.elements())
return reduce(lambda x,y: x*y, b)
示例2: problem12
# 需要導入模塊: import HelperFunctions [as 別名]
# 或者: from HelperFunctions import primeFactorization [as 別名]
def problem12():
flag = True
n = 1
i = 2
while True:
number = 1
nDiv = mset(hf.primeFactorization(n))
exp = nDiv.most_common()
for ex in exp:
number *= ex[1] + 1
if number > 500:
return n
n += i
i += 1