质数因子——python3题解
质数因子
http://www.nowcoder.com/questionTerminal/196534628ca6490ebce2e336b47b3607
n = int(input()) def judge(number): if number<=1: return False for i in range(2,number//2+1): if number%i == 0: return False return True if n==2 or n==3: print(n,end = ' ') else: r = 2 is_prime = True while n >= 2: if n%r==0: if is_prime: print(r, end = ' ') n = n//r else: is_prime = judge(r) else: r += 1