Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import math
- def isPrime(num):
- if num % 2 == 0:return 0
- for x in range(2, int(math.ceil(math.sqrt(num)))+1):
- if ((num % x) == 0):return 0
- return 1
- count = 0
- for x in xrange(1000**2, 1, -1):
- if(isPrime(x) == 1):
- total = 0
- for y in list(str(x)):
- total = total + int(y)
- if total == 14:count = count + 1
- print count
Advertisement
Add Comment
Please, Sign In to add comment