12 lines
173 B
Python
12 lines
173 B
Python
|
for num in range(1, 5001):
|
||
|
total = 0
|
||
|
rem = num
|
||
|
|
||
|
while rem > 0:
|
||
|
digit = rem % 10
|
||
|
total += pow(digit, digit)
|
||
|
rem //= 10
|
||
|
|
||
|
if total == num:
|
||
|
print(total)
|