N is a m-th power of an integer.
It consists of n distinct digits, averaging n.
Find n,m and N, using your head + pen and paper only.
Check, whether there exist additional solutions (computer allowed).
Clearly, n>1; m>1 - to exclude trivial cases.
DECLARE SUB addOn (upto#)
DEFDBL A-Z
CLS
DIM SHARED used(9), h(6), n, sod, tot, value, scount
FOR n = 2 TO 6
sod = n * n
FOR first = 1 TO 9
used(first) = 1
h(1) = first
value = first
tot = first
addOn 2
used(first) = 0
NEXT
NEXT
PRINT scount
SUB addOn (upto)
FOR new = 0 TO 9
IF tot + new <= sod THEN
IF used(new) = 0 THEN
used(new) = 1
h(upto) = new
svalue = value
value = 10 * value + new
tot = tot + new
IF upto = n THEN
IF tot = sod THEN
FOR rt = 2 TO 20
r = INT(value ^ (1 / rt) + .5)
IF value = INT(r ^ rt + .5) THEN
PRINT value, r; "^"; rt
scount = scount + 1
END IF
NEXT rt
END IF
ELSE
addOn upto + 1
END IF
used(new) = 0
value = svalue
tot = tot - new
END IF
END IF
NEXT
END SUB
finds 12 solutions:
216 = 6 ^ 3
243 = 3 ^ 5
324 = 18 ^ 2
3481 = 59 ^ 2
9025 = 95 ^ 2
12769 = 113 ^ 2
30976 = 176 ^ 2
37249 = 193 ^ 2
85264 = 292 ^ 2
96721 = 311 ^ 2
287496 = 66 ^ 3
751689 = 867 ^ 2
More than 6 distinct digits would be impossible as 7 digits would require a total of 7*7=49 and the highest that 7 distinct digits could be would be 9+8+7+6+5+4+3=42.
|
Posted by Charlie
on 2014-01-27 13:33:02 |