Solution for the PowerDigitSum problem