加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Python Program for Product of unique prime factors of a number 470 Bytes
一键复制 编辑 原始数据 按行查看 历史
# Python program to find sum of given
# series.
def productPrimeFactors(n):
product = 1
for i in range(2, n+1):
if (n % i == 0):
isPrime = 1
for j in range(2, int(i/2 + 1)):
if (i % j == 0):
isPrime = 0
break
# condition if \'i\' is Prime number
# as well as factor of num
if (isPrime):
product = product * i
return product
# main()
n = 44
print (productPrimeFactors(n))
# Contributed by _omg
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化