The number N can have no more than 10 digits, as
9^9 = 387,420,489
so that even 11 repetitions of 9 would result in only a 10digit number.
The following program checks the sums of all combinations from 1 to 10 digits and sees if the total has the same set of digits. If that's the case, then the total is the given number:
DEFDBL AZ
DECLARE SUB tackOn ()
DIM SHARED v(9), n$, tot
FOR i = 1 TO 9
v(i) = i ^ i
NEXT
tackOn
END
DEFDBL AZ
SUB tackOn
IF LEN(n$) = 0 THEN st = 1: ELSE st = VAL(RIGHT$(n$, 1))
FOR dig = st TO 9
tot = tot + v(dig)
n$ = n$ + LTRIM$(STR$(dig))
t$ = LTRIM$(STR$(tot))
DO
done = 1
FOR i = 1 TO LEN(t$)  1
IF MID$(t$, i, 1) > MID$(t$, i + 1, 1) THEN
h$ = MID$(t$, i, 1)
MID$(t$, i, 1) = MID$(t$, i + 1, 1): MID$(t$, i + 1, 1) = h$
done = 0
END IF
NEXT i
LOOP UNTIL done
IF t$ = n$ THEN
PRINT tot
END IF
IF LEN(n$) < 10 THEN tackOn
n$ = LEFT$(n$, LEN(n$)  1)
tot = tot  v(dig)
NEXT dig
END SUB
Only 92,377 combinations of digits had to be checked this way, rather than all 1 through 10digit numbers.
the results were
1
3435
as, when the program was checking out 3,3,4,5 and the total came out to 3435, it recognized that the digits were the same but in a different order, and printed the total.
So 3435 is the only other number aside from 1 fitting the criteria.

Posted by Charlie
on 20081115 16:44:23 