An integer N consisting of five distinct nonzero digits has the curious property that it is equal to the sum of all the different three-digit integers formed by the three digit permutations of its five digits. Find N.
(In reply to
re: Solution by Charlie)
A program implementing the algorithm for solution is:
FOR i = 8 TO 75
s$ = LTRIM$(STR$(1332 * i))
t = 0
FOR j = 1 TO LEN(s$)
t = t + VAL(MID$(s$, j, 1))
NEXT
IF t = i THEN PRINT s$
NEXT
It needs check only 68 possibilities. It finds one solution:
35964
|
Posted by Charlie
on 2004-06-30 09:51:25 |