Determine if a number is perfect digit to digit

This commit is contained in:
Nick Chambers 2024-06-03 03:52:22 -05:00
parent b137d99a96
commit cd096b8551
1 changed files with 11 additions and 0 deletions

11
python/pdtd.py Normal file
View File

@ -0,0 +1,11 @@
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)