2013年1月6日

Problem 3 - Largest prime factor

摘要: The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?求600851475143的最大素数因子。Python 1 factors = [] 2 maximum = 600851475143 3 def getFactor(x): 4 y = x / 2 5 i = 2 6 while True: 7 if i > y: 8 break 9 if x %... 阅读全文

posted @ 2013-01-06 08:47 luchigster 阅读(128) 评论(0) 推荐(0) 编辑

2013年1月5日

Problem 2 - Even Fibonacci numbers

摘要: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-value 阅读全文

posted @ 2013-01-05 10:33 luchigster 阅读(93) 评论(0) 推荐(0) 编辑

Problem 1 - Multiples of 3 and 5

摘要: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.在小于1000的自然数{0,1,2,3,4,~}中,将凡是3和5的倍数的自然数加和。Python 1 # 1 2 maximum = 1000 3 summary = 0 4 for i in range(1,maximum): 5 阅读全文

posted @ 2013-01-05 10:21 luchigster 阅读(141) 评论(0) 推荐(0) 编辑

导航