题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
from math import sqrt num = int(input()) factor = 2 for i in range(2, int(sqrt(num) + 1)): while num % i == 0: print(i, end=" ") num //= i if num > 2: print(num)
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
from math import sqrt num = int(input()) factor = 2 for i in range(2, int(sqrt(num) + 1)): while num % i == 0: print(i, end=" ") num //= i if num > 2: print(num)
相关推荐