from lib_misc import get_digit_count def get_n_digit_positive_integers(n): r = [] i = 1 while True: if get_digit_count(i ** n) == n: r.append(i ** n) if get_digit_count(i ** n) > n: return r i += 1 def euler_063(): s = sum([len(get_n_digit_positive_integers(n)) for n in range(1, 1000)]) return s if __name__ == "__main__": print("e063.py: " + str(euler_063())) assert(euler_063() == 49)