from itertools import combinations,permutations
=======
星星之火,可以燎原
=======
<<<<<<< HEAD
=======
>>>>>>> 5b12387eb027317eaedcd8fb9a268f4e19c2ade4
<<<<<<< HEAD
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
>>>>>>> 5b12387eb027317eaedcd8fb9a268f4e19c2ade4
>>>>>>> 4ef99384a791603d1ae54a12162221aa23eb330e
基于python的求某数在其若干个质因数相乘下的商
2022-02-22
python
基于python的求某数在其若干个质因数相乘下的商
2022-02-22
from itertools import combinations,permutations
>>>>>>> 4ef99384a791603d1ae54a12162221aa23eb330e
list1 = [2, 2, 2, 3, 3, 3, 5]
list2=[]
for n in range(7):
c = list(set(combinations(list1,n+1)))
for key in c:
mul = 1
for i in key:
mul = mul * i
list2.append(mul)
list2.sort()
for item in list2:
print("1080 / ",item,'=',1080/item)
# 输出结果
# 1080 / 2 = 540.0
# 1080 / 3 = 360.0
# 1080 / 4 = 270.0
# 1080 / 5 = 216.0
# 1080 / 6 = 180.0
# 1080 / 8 = 135.0
# 1080 / 9 = 120.0
# 1080 / 10 = 108.0
# 1080 / 12 = 90.0
# 1080 / 15 = 72.0
# 1080 / 18 = 60.0
# 1080 / 20 = 54.0
# 1080 / 24 = 45.0
# 1080 / 27 = 40.0
# 1080 / 30 = 36.0
# 1080 / 36 = 30.0
# 1080 / 40 = 27.0
# 1080 / 45 = 24.0
# 1080 / 54 = 20.0
# 1080 / 60 = 18.0
# 1080 / 72 = 15.0
# 1080 / 90 = 12.0
# 1080 / 108 = 10.0
# 1080 / 120 = 9.0
# 1080 / 135 = 8.0
# 1080 / 180 = 6.0
# 1080 / 216 = 5.0
# 1080 / 270 = 4.0
# 1080 / 360 = 3.0
# 1080 / 540 = 2.0
# 1080 / 1080 = 1.0
<<<<<<< HEAD