def change(n): n = str(n) for p1 in range(len(n) - 2): if int(n[p1]) > 10 - pri: continue for p2 in range(p1 + 1, len(n)-1): if n[p1] == n[p2]: c = 0 for i in range(10): if (10 - i) - (pri - c) < 0: break if p1 == 0 and i == 0: continue if int(n[p1]) > i: continue if is_prime(int(replace(n, str(i), p1, p2)), primes): c += 1 if c == pri: return True return False
def nextprime(prime, checkprimes): n = prime + 2 while not is_prime(n, checkprimes): n +=2 return n
def areprime(a): return primetools.is_prime(a[0], primes) and primetools.is_prime(a[1], primes)