Moved solutions till 35 to Python.
This commit is contained in:
13
python/e030.py
Normal file
13
python/e030.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def euler_030():
|
||||
fifth_power_lookup = {str(i): i**5 for i in range(0, 10)}
|
||||
|
||||
def is_number_sum_of_fiths_powers_of_digits(n):
|
||||
return n == sum([fifth_power_lookup[d] for d in str(n)])
|
||||
|
||||
return sum([i for i in range(2, 1000000)
|
||||
if is_number_sum_of_fiths_powers_of_digits(i)])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("e030.py: {}".format(euler_030()))
|
||||
assert(euler_030() == 443839)
|
||||
Reference in New Issue
Block a user