eg: 12345
1^2+2^3+3^4+4^5+5^5
LOGIC: is first digit should be multiplied to the number of times of the next number,likewise next numbers should be calculated and last digit should be multiplied by the number of times of total digit of the number. for example last 5 is multiplied by 5 because there are 5 digits in this number.
eg 2: 1789
1^7+7^8+8^9+9^4