|
发表于 2018-9-11 23:18:28
|
显示全部楼层
- >>> def maxYs( x, y ):
- x,y = (x,y) if x < y else (y,x)
- while x:
- x,y = y%x, x
- return y
- >>> def minBs( *ns ):
- r = 1
- for n in ns:
- if n:
- r = r * n // maxYs(r,n)
- return r
- >>> minBs(4,6)
- 12
- >>> def fb():
- a,b=1,1
- while True:
- yield a
- a,b = b,a+b
-
- >>> def fun( n = 10 ):
- res = []
- f = fb()
- cnt = 0
- while cnt < n:
- t = next(f)
- if t < 10:
- continue
- if t % minBs(*[int(x) for x in str(t)]) == 0:
- cnt += 1
- res.append( t )
- return res
- >>> fun()
- [55, 144, 46368, 5358359254990966640871840, 64202014863723094126901777428873111802307548623680, 769246427201094785080787978422393713094534885688979999504447628313150135520, 9216845717656874712980450562726202415567360565980794777111390850331644813674856981646960226192287360, 110433070572952242346432246767718285942590237357555606380008891875277701705731473925618404421867819924194229142447517901959200, 1323171012053243520828784042795469593341319770463238313551473338336502410952765153371119398122747569819754164672344667591018783803781288766524146031040, 15853779289614481577191691577533518174485949824765525957623037737532160833631593681512535189759649213804709691705593604227037581022758330489263385511067756715301085561591382880]
- >>>
复制代码 |
评分
-
查看全部评分
|