Python-Project Euler 41
来源:互联网 发布:开淘宝培训学校 编辑:程序博客网 时间:2024/05/01 12:45
from isPrime import *
ans=[]
f=[]
def check():
global f
s=''
for i in range(len(f)):
s+=str(f[i])
if isPrime(s)==True:
return True
else:
return False
def go(k,n):
global f
for i in range(n,0,-1):
if i not in f:
f.append(i)
if (len(f)==n and check()==True):
ans[:]=f[:]
print(len(f),' ',len(ans),' ',ans)
go(k+1,n)
f.pop()
go(1,7)
print(ans)
ans=[]
f=[]
def check():
global f
s=''
for i in range(len(f)):
s+=str(f[i])
if isPrime(s)==True:
return True
else:
return False
def go(k,n):
global f
for i in range(n,0,-1):
if i not in f:
f.append(i)
if (len(f)==n and check()==True):
ans[:]=f[:]
print(len(f),' ',len(ans),' ',ans)
go(k+1,n)
f.pop()
go(1,7)
print(ans)
0 0
- Python-Project Euler 41
- Python-Project Euler 22
- Python-Project Euler 24
- Python-Project Euler 26
- Python-Project Euler 27
- Python-Project Euler 29
- Python-Project Euler 30
- Python-Project Euler 31
- Python-Project Euler 32
- Python-Project Euler 36
- Python-Project Euler 37
- Python-Project Euler 38
- Python-Project Euler 39
- Python-Project Euler 40
- Python-Project Euler 42
- Python-Project Euler 43
- Python-Project Euler 45
- Python-Project Euler 46
- 360和阿里巴巴本来就是战略伙伴
- linux下负载测试工具ab
- Bootstarp学习教程(15) 其他组件(3)
- Codeforces Round #224 (Div. 2)
- PHP判断远程url是否有效的几种方法
- Python-Project Euler 41
- 十干原度數
- MySQL查询表内重复记录
- 浅谈Java中static作用
- 让你的App能够在搜索结果中唤起
- 今天刚知道原来参考文献可以自动生成
- 十一吟
- 10167 - Birthday Cake
- AMD高端不死!真16核处理器首度曝光