赞
踩
- import math
- def is_prime(n):
- if n < 2:
- return False #0和1不是素数
- for i in range(2, int(math.sqrt(n))+1):
- if n % i == 0:
- return False
- break
- else:
- return True
- def plalindrome_prime(number):
- if str(number)==str(number)[::-1] and is_prime(number):
- return True
- else:
- return False
- def reverse_prime(number):
- for i in range(number):
- if plalindrome_prime(i)==False and is_prime(i)==True and is_prime(int(str(i)[::-1]))==True:
- print(i,end=' ')
- positive_int = int(input())
- reverse_prime(positive_int)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。