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`

.

Are you sure 1237940039285380274899124224 = 510^10? Isn't 510^10 equal to 1190424238276130010000000000? Maybe I didn't understand correctly. – Z-Y.L – 2013-06-12T13:00:27.390

My apologies-It's 512^10. – John_dydx – 2013-06-12T13:04:08.623

`FactorInteger`

? – Oleksandr R. – 2013-06-12T13:06:08.973@Oleksandr R.-FactorInteger is very helpful, thanks – John_dydx – 2013-06-12T13:09:20.883

6@John Your question doesn't make sense unless you explain why you prefer $512^{10}$ rather than $2^{90}$. This is a special case, in general your expectations are not clear at all. – Artes – 2013-06-12T13:17:38.233

1@Artes, I wish to express the number in index form with the largest possible base if that makes sense-sry I wasn't explicit from the start. I wish to obtain 512^10 rather than 2^90-It's needed to solve a bigger problem. – John_dydx – 2013-06-12T13:20:23.547

1If it helps I'm trying to solve Euler problem 119. – John_dydx – 2013-06-12T13:25:28.293

1@John Just explain why you prefer $512^{10}$ rather than e.g. $1024^9$ or $32^{18}$. – Artes – 2013-06-12T13:28:53.097

1@ Artes-here's the problem i'm trying to solve: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284.

We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. You are given that a2 = 512 and a10 = 614656. Find a30. – John_dydx – 2013-06-12T13:32:37.093

@John FYI, sometimes it is useful to think about a problem in reverse. – Mr.Wizard – 2013-06-12T16:44:12.113