分解质因数
作者:互联网
例如:输入6,输出 2*3=6
def prime_factor(): n = int(input()) old_n = n nums = [] while n > 1: for i in range(2, n+1): if n % i == 0: n //= i nums.append(str(i)) break res = '*'.join(nums) + '=' + str(old_n) print(res)
标签:prime,old,nums,res,分解,str,join,质因数 来源: https://www.cnblogs.com/xuqidong/p/16437849.html