# How many integers of $m$ digits are equal to the sum of the $m$ -th powers of their digits in base $7$ in the interval $[1, …, 10 ^ 7]$?

In a previous question I was checking the following number theory excercise:

The number $$1634$$ has an interesting property. This 4-digit number satisfies that the sum of the fourth powers of its digits gives the same number. That is, $$1 ^ 4 + 6 ^ 4 + 3 ^ 4 + 4 ^ 4$$ $$=$$ $$1634$$. How many integers of $$m$$ digits are equal to the sum of the $$m$$ -th powers of their digits in the interval $$[1, ..., 10 ^ 7]$$? What is the largest of those complies with said property in the same interval?

Through many calculations and help of people here We found $$15$$ numbers with the respective characteristics. Now I have an extension of that problem:

The above problem can also be considered in other bases. For example, in base $$5$$, the integer $$28$$ fulfills this condition. In effect, $$28$$ in base $$5$$ is $$(103) _5$$, and the third powers (length of the integer in base $$5$$) of his figures is $$1 ^ 3$$ $$0 ^ 3$$ $$3 ^ 3$$ = $$1+0+27$$ = $$28$$. How many integers with the previous property are in base $$7$$ contained in the interval [$$1, ..., 10 ^ 7$$]? Which one is the biggest?

For the first part of the problem to find the $$15$$ numbers with the first conditions I noted that for any given exponent only need to check up to some number of digits. For exponent $$k$$ and $$m$$ digits the greatest the sum can be is $$m9^k$$, but an $$m$$ digit number is at least $$10^{m-1}$$. Roughly when $$m \gt k$$ I had $$10^{m-1} \gt m9^k$$ and I was ok with that $$k$$. But now I'm dealing with the base change, how do I modify my first thoughts about it based on that? Any help will be really appreciated.

## 1 Answer

It works exactly the same when you fix the constants. An $$m$$ digit number in base $$b$$ is at least $$b^{m-1}$$. The greatest the sum can be is $$m(b-1)^k$$. There will be an $$m$$ where the sum is guaranteed to be less than the number.