# 使用递归进行整数的因式分解
from random import randint
def factors(num, fact = []):
#每次从2开始查找因数
for i in range(2, int(num/2) + 1):
if num % i == 0:
fact.append(i)
factors(num // i, fact)
break
else:
fact.append(num)
facts = []
n = randint(2, 10**8)
factors(n, facts)
result = '*'.join(map(str, facts))
#把facts里的元素,全部转化成字符
#并用*号连接起来,形成一个长的字符串 表达式
if n == eval(result):
print(n, '= ' + result)