Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product as p
- def is_prime(n):
- d = 2
- while d * d <= n and n % d != 0:
- d += 1
- return d * d > n
- def get_total_primes(a, b):
- c=0
- for j in range(len(str(a)),len(str(b))+1):
- for i in p('2357',repeat = j):
- q = int(''.join(i))
- if a<=q<b and is_prime(q):
- c+=1
- return c
Advertisement
Add Comment
Please, Sign In to add comment