euler/python/e063.py

23 lines
470 B
Python
Raw Normal View History

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
2019-07-18 03:29:59 +02:00
def euler_063():
s = sum([len(get_n_digit_positive_integers(n)) for n in range(1, 1000)])
return s
2019-07-18 03:29:59 +02:00
if __name__ == "__main__":
print("e063.py: " + str(euler_063()))
assert(euler_063() == 49)