博客代码高亮测试

dr_pure Lv5

python质因数分解代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import math
number = int(raw_input("Enter a number: "))
list = []
def getChildren(num):
print '*'*30
isZhishu = True
i = 2
square = int(math.sqrt(num)) + 1
while i <= square:
if num % i == 0:
list.append(i)
isZhishu = False
getChildren(num / i)
i += 1
break
i += 1
if isZhishu:
list.append(num)
getChildren(number)
print list
  • 标题: 博客代码高亮测试
  • 作者: dr_pure
  • 创建于 : 2018-10-01 19:00:00
  • 更新于 : 2018-10-01 19:00:00
  • 链接: https://blog.lfn.moe/posts/3f9f977c/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
博客代码高亮测试