How to find the numbers that are the sum of fifth powers of their digits in Python

1 Answer

0 votes
lst = [i for i in range(1000, 1000000) if i == sum(int(d) ** 5 for d in str(i))]

print(lst)




'''
run:

[4150, 4151, 54748, 92727, 93084, 194979]

'''

 



answered Dec 5, 2023 by avibootz
...