Advertisement
ke1dan

Untitled

Jul 10th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. from itertools import combinations_with_replacement as cp
  2. from itertools import permutations as p
  3. import gmpy2
  4.  
  5. def is_prime(num):
  6.     return gmpy2.is_prime(num) if num > 0 else False
  7.  
  8. def get_total_primes(a, b):
  9.     c=0
  10.     for i in cp('2357',len(str(b))):
  11.         q = int(''.join(i))
  12.         if p in range(a,b) and is_prime(q):
  13.             c+=1
  14.     return c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement