def square_digit(num): ll = euler_utils.get_digits(num) res = 0 for x in ll: res += math.pow(x, 2) return int(res)
def replace(num, digits): ll = euler_utils.get_digits(num) # print 'll = ', ll smallest = 0 # for x in digits: temp = ll count = 0 for x in xrange(0,10): # for y in xrange(0,10): temp[digits[0]] = x temp[digits[1]] = x num = euler_utils.create_num_from_list(temp) if len(euler_utils.get_digits(num)) == len(ll): if euler_utils.is_prime(num): count += 1 if smallest == 0: smallest = num if num < smallest: smallest = num if count == 7: return smallest else: return -1
def is_prime_proof(num): ll = euler_utils.get_digits(num) for i in xrange(0, len(ll)): x = ll[i] for y in xrange(0,10): if y == x: continue ll[i] = y new_num = euler_utils.create_num_from_list(ll) if sympy.ntheory.isprime(new_num): return False ll[i] = x return True
def is_prime_proof(num): ll = euler_utils.get_digits(num) for i in xrange(0, len(ll)): x = ll[i] for y in xrange(0, 10): if y == x: continue ll[i] = y new_num = euler_utils.create_num_from_list(ll) if sympy.ntheory.isprime(new_num): return False ll[i] = x return True
def check_9_first_pandigital(num): ll = euler_utils.get_digits(num)[:9] return check_if_pandigital(ll)
def check_9_last_pandigital(num): ll = euler_utils.get_digits(num)[-9:] if len(ll) < 9: return False return check_if_pandigital(ll)