def isTargetNumber(x, minNumOfPrime): poses = getPos(x) for pos in poses: tmp = getCandiAtPos(x, pos) cum = 0 for c in tmp: if isPrime(c): cum += 1 if cum>=minNumOfPrime: primes = [] for p in tmp: if isPrime(p): primes += [p] return (True, tuple(primes)) return (False, ())
def is_prime_pair(x, y): v1 = int("".join(map(str, (x, y)))) v2 = int("".join(map(str, (y, x)))) return isPrime(v1) and isPrime(v2)