分解质因数
时间:2020-08-05 09:14:07
收藏:0
阅读:96
pyschools Topic 5: Question 12题目:分解质因素
Given a positive integer, write a function that computes the prime factors that can be multplied together to get back the same integer.
def primeFactorization(num): factor=[] while num>1: for i in range(2,num+1): if num%i==0: factor.append(i) num = num//i break return factor
原文:https://www.cnblogs.com/yongestcat/p/13437658.html
评论(0)