Why is 438579088 a perfect digit-to-digit invariant?

A PDDI (perfect digit-to-digit invariant) is a number which is also the sum of each of it's digits raised to them self.

My main problem with the number 438579088 being a PDDI is the 7th number - 0. Breaking 438579088 down to check if it's a PDDI or not:

• 4^4 = 256
• 3^3 = 27
• 8^8 = 16777216
• 5^5 = 3125
• 7^7 = 823543
• 9^9 = 387420489
• 0^0 = 1
• 8^8 = 16777216
• 8^8 = 16777216

I had a program to find the sum of these numbers and I've checked it numerous times with different approaches, and each time I receive the number 438579089, 1 number off 438579088. My hypothesis is that the 0 is being miscalculated - I do seem to remember any number to the power of 0 is 1, however.

In my code, (where num is 438579088) total would indeed be 438579088:

 for i in str(num):
if int(i) != 0:
total += pow(int(i), int(i))


but, when I stopped checking if i was 0,

for i in str(num):
total += pow(int(i), int(i))


I received 438579089. Why does this happen? This isn't so much a code problem but a mathematical problem. I can't understand why many sources say this number is a PDDI where also saying that 0^0 = 1.

I've never come across this before. But one can define concepts however one likes, and a quick check around indicates that a PDDI comes with the convention that $0^0 = 0$. See for instance wikipedia or magic-squares.net.
You might find it interesting to study Meunchhausen Numbers. It is not all obvious to me that there are exactly four Meunchhausen numbers. This gives a base-level interest to using the convention that $0^0 = 0$, since
You might be interested in studiying PDDI numbers using the more standard convention that $0^0 = 1$. I encourage you - go for it! This is part of the attraction of recreational mathematics.