from tools import number_theory def unit(p): base = 1 loop = 1 while True: base %= p if not base: return loop base = 10 * base + 1 loop += 1 def is_dec(num): while not num % 2: num //= 2 while not num % 5: num //= 5 return 1 == num def statistic(limit): prime = number_theory.make_prime(limit) next(prime) next(prime) next(prime) for p in prime: if is_dec(unit(p)): yield p #print(list(statistic(100000))) get = [11, 17, 41, 73, 101, 137, 251, 257, 271, 353, 401, 449, 641, 751, 1201, 1409, 1601, 3541, 4001, 4801, 5051, 9091, 10753, 15361, 16001, 19841, 21001, 21401, 24001, 25601, 27961, 37501, 40961, 43201, 60101, 62501, 65537, 69857, 76001, 76801] print(sum(set(number_theory.make_prime(100000)) - set(get)))