You are viewing a single comment's thread. Return to all comments →
My sense was to do the following.
MIN = 2 MAX = 1000000 def compute(value): ans = sum(i for i in range(MIN, MAX) if i == power_digit_sum(value, i)) return str(ans) def power_digit_sum(value, n): return sum(int(c) ** value for c in str(n)) if __name__ == "__main__": value = int(input()) print(compute(value))
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #30: Digit Nth powers
You are viewing a single comment's thread. Return to all comments →
My sense was to do the following.