Hello and welcome to the challenge!
A magic number is a number which fulfills this dependence: d1^1 + d2^2 + ... + dn^n = D
, where D
is the number and d1..dn
are its digits (respectively). The example of such a number is 135
, because 1^1 + 3^2 + 5^3 = 135
. Write a code which detects all magic numbers in the given range x..y
.
Have fun and good luck! :)