Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- def isPrime(num):
- for x in range(2, (int(num**.5)+1)):
- if num % x == 0:
- return False
- return True
- if __name__ == '__main__':
- prime_numbers = []
- for x in range(2, 1000000):
- if isPrime(x):
- prime_numbers.append(x)
- # print prime_numbers
- totalprime = 0
- for num in prime_numbers:
- num = str(num)
- num1 = list(num)
- # total = []
- primecount = 0
- for y in num1:
- temp = num1.pop(0)
- num1.append(temp)
- total = ''
- for x in num1:
- total += x
- intTotal = int(total)
- if isPrime(intTotal):
- primecount += 1
- if primecount == len(num):
- totalprime += 1
- print "Total number of primes is:", totalprime
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement