Here's a way to brute-force search for numbers that have the property that the sum of the digits raised to an integer power is equal to the number itself.
list = {};
Do[If[Total[IntegerDigits[b^e]] == b,
AppendTo[list, {b, e}]], {b, 2, 800}, {e, 2, 100}];
This returns a list of the numbers and powers (here's just the first 50), ordered so that they are in numerical order by b^e
ord = Ordering[#[[1]]^#[[2]] & /@ list];
list[[ord]][[1 ;; 50]]
{{9, 2}, {8, 3}, {7, 4}, {17, 3}, {18, 3}, {26, 3}, {27, 3}, {22, 4}, {25, 4},
{28, 4}, {36, 4}, {28, 5}, {18, 6}, {35, 5}, {36, 5}, {46, 5}, {18, 7}, {45, 6},
{27, 7}, {54, 6}, {31, 7}, {34, 7}, {64, 6}, {43, 7}, {53, 7}, {58, 7}, {68, 7},
{46, 8}, {54, 8}, {63, 8}, {54, 9}, {71, 9}, {20, 13}, {81, 9}, {82, 10},
{85, 10},{94, 10}, {97, 10}, {106, 10}, {117, 10}, {40, 13}, {98, 11},
{107, 11}, {108, 11}, {108, 12}, {86, 13}, {103, 13}, {104, 13}, {106, 13}, {107, 13}}
and we can see that with $(8,3)=8^3$ defined as $a_2$, $(28,4)=28^4$ is $a_{10}$ and so on. The 30th is $(63,8)=63^8$.
Doing a google search I now see that this search method is well known, for instance, here and here.
It always makes me nervous using Do
. Here's a one-line functional version of the above:
Select[If[Total[IntegerDigits[#[[1]]^#[[2]]]] == #[[1]], {#[[1]], #[[2]]}] &
/@ Flatten[Outer[List, Range[2, 600], Range[2, 100]], 1], UnsameQ[#, Null] &]
Set the range for the base in the first of the two Range
commands and the range for the exponent in the second Range
.