I'm trying to solve the 30th euler problem. My code is working, but I'm not sure if it's luck or ingeniousness.
To be the most efficient, I want to reduce at the maximum the numbers to checks.
I feel a solution, but not sure if it's true.
Given p as the power to use, I want to know what is the greatest possible sum of all powers of each digit of any number.
I use the formula below :
max(sum(d(x) pow P ) = (p+1)*(9 pow p)
because
P = 2 : 3 * (9^2) = 243 > 99 // works P = 3 : 4 * (9^3) = 2916 > 999 // works P = 4 : 5 * (9^4) = 32805 > 9999 // works
However, I don't know if it's true whichever P is, or if it's a coincidence. And I reduce my range correctly.
PS: I have no mathematics background, apologize, if my notation is not academic