题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
def getZhiYinZi(zhengshu):
zhiyinzi = []
i = 2
while i * i <= zhengshu:
#不能整除i+1
if zhengshu % i != 0:
i += 1
#能整除是质因子
else:
zhiyinzi.append(int(i))
zhengshu = zhengshu / i
if zhengshu > 1:
zhiyinzi.append(int(zhengshu))
return zhiyinzi
n = int(input())
ans = getZhiYinZi(n)
print(*ans, sep=" ")