You are viewing a single comment's thread. Return to all comments →
This code workes well using python 3
def main(): n = int(input()) total_sum = 0 for i in range(2, 10**6): temp = i sum1 = 0 while temp > 0: a = temp % 10 sum1 += a**n temp = temp // 10 if sum1 == i: total_sum += sum1 print(total_sum) if __name__ == "__main__": main()
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 →
This code workes well using python 3