
欧拉计划
傅晓玲
当你还不能写出自己满意的程序时,你就不要去睡觉。
展开
-
Python实现欧拉计划第十题
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.----------------------------------------------------------------------------------fr原创 2016-04-26 12:17:56 · 352 阅读 · 0 评论 -
欧拉计划23
def d(i): k=0 #判断一个数(小于28123)是否写成两个过剩数的和,不能的话返回为真 for m in range(0,len(M)): for n in range(0,len(M)): #M为小于28123的所有的过剩数 if i==M[m]+M[n]原创 2016-05-13 19:40:03 · 496 阅读 · 0 评论 -
Python实现欧拉计划23题
def d(i): k=0 #判断一个数(小于28123)是否写成两个过剩数的和,不能的话返回为真 for m in range(0,len(M)): for n in range(0,len(M)): #M为小于28123的所有的过剩数 if i==M[m]+M[n]原创 2016-05-13 19:41:32 · 530 阅读 · 0 评论 -
Python实现欧拉计划20题
n! means n × (n − 1) × ... × 3 × 2 × 1For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.Find the sum of the digi原创 2016-05-03 15:28:02 · 737 阅读 · 0 评论 -
pyhton实现欧拉计划28题
sum=1x=1for i in range(1,501): for j in range(0,4): x=x+2*i sum=sum+xprint (sum)===========================思路12,3,4,5,6,7,8,9、10,11,12,13,14,15,16,17,18,19,20,21原创 2016-05-27 11:53:52 · 291 阅读 · 0 评论 -
python实现欧拉计划29题
注意set的使用===================print (len(set(a**b for a in range(2, 101) for b in range(2, 101))))原创 2016-05-27 12:10:37 · 361 阅读 · 0 评论 -
python实现欧拉计划24题
逆康拓展开式import mathL=[0,1,2,3,4,5,6,7,8,9]M=[]m=999999for i in range(9,-1,-1): x=(m/(math.factorial(i))) print x y=(m%(math.factorial(i))) m=y M.append(L[x]) L.po原创 2016-05-16 16:55:16 · 301 阅读 · 0 评论 -
python实现欧拉计划25题
def f(n): if n==1 or n==2: return 1 else: a=D[n-1]+D[n-2] D[n]=a return an=1D={1:1,2:1}while len(str(f(n))) n=n+1 print f(n)print n===原创 2016-05-17 13:37:30 · 339 阅读 · 0 评论 -
python 实现欧拉计划26题
def cycle_length(n): i = 1 if n % 2 == 0: return cycle_length(n / 2) if n % 5 == 0: return cycle_length(n / 5) while True: if (10**i - 1) % n == 0: return i else:原创 2016-05-17 16:13:18 · 407 阅读 · 0 评论 -
python实现欧拉计划第十二题
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 2原创 2016-04-27 10:50:36 · 523 阅读 · 0 评论 -
Python实现欧拉计划19题
You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,April, June and November.All the rest have thirty原创 2016-05-03 14:48:50 · 444 阅读 · 2 评论 -
python实现欧拉计划18题
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.37 42 4 68 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find th原创 2016-04-30 12:14:32 · 427 阅读 · 0 评论 -
Python实现欧拉计划第九题
A Pythagorean triplet is a set of three natural numbers, a b c, for which,a2 + b2 =c2For example, 32 + 42 = 9 + 16 = 25 = 52.There exists exactly one Pythagorean triplet for which a + b +原创 2016-04-26 10:48:56 · 422 阅读 · 0 评论 -
python实现欧拉计划第十一题
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56转载 2016-04-27 09:05:14 · 720 阅读 · 0 评论 -
python实现欧拉计划第十三题
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.37107287533902102798797998220837590246510135740250463769376774900097126481248969700780504170182605387432498原创 2016-04-27 11:27:56 · 832 阅读 · 0 评论 -
python实现欧拉计划第十四题
The following iterative sequence is defined for the set of positive integers:n → n/2 (n is even)n → 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following sequen原创 2016-04-27 12:13:58 · 490 阅读 · 0 评论 -
Python实现欧拉计划22题
def f(n): value={'A':1,'B':2,'C':3,'D':4,'E':5,'F':6,'G':7,'H':8,'I':9,'J':10,'K':11,'L':12,'M':13,'N':14,'O':15,'P':16,'Q':17,'R':18,'S':19,'T':20,'U':21,'V':22,'W':23,'X':24,'Y':25,'Z':26,}原创 2016-05-10 14:52:15 · 297 阅读 · 0 评论 -
python实现欧拉计划15题
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.How many such routes are there through a 2原创 2016-04-28 18:36:59 · 323 阅读 · 0 评论 -
Python实现欧拉计划16题
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000?---------------------------------------------------------------------------a=str原创 2016-04-28 19:18:25 · 333 阅读 · 0 评论 -
Python实现欧拉计划27题
import mathfrom time import clocktime1=clock()def IsPrime(x): if x return False for i in range(2,int(math.sqrt(x))+1): if x%i==0: return原创 2016-05-24 20:10:55 · 311 阅读 · 0 评论 -
Python实现欧拉计划17题
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusive we原创 2016-04-29 14:16:26 · 830 阅读 · 0 评论 -
Python实现欧拉计划21题
def d(n): result=[a for a in range(1,n) if n%a==0] y=sum(result) return yL=[]for i in range(2,10001): m=d(i) if d(m)==i and m!=i: L.append(i) i=i+1print su原创 2016-05-08 15:06:47 · 300 阅读 · 0 评论