Euler第三题

帮同学做道题....其实真没什么好的做法....

 

 1 def getList(n):
 2     result = []
 3     count = 3
 4     max = n
 5     while max%2 == 0:
 6         max /= 2
 7         result.append(2)
 8     
 9     while count <= max:
10         if max%count == 0:
11             result.append(count)
12             max /= count
13         else:
14             count += 2
15     return result
16 

17 print getList(600851475143) 

posted @ 2011-07-31 23:55  飞林沙  阅读(539)  评论(1编辑  收藏  举报