N is a positive base ten integer having at least 2digits but at most 4digits, which is obtained by multiplying the sum of its digits with the product of its digits. It is known that N cannot contain any leading zero.
Determine all possible value(s) of N.
(In reply to
Solution & thoughts by Jer)
DEFDBL AZ
FOR n = 10 TO 999999
s$ = LTRIM$(STR$(n))
sum = 0: prod = 1
FOR i = 1 TO LEN(s$)
d = VAL(MID$(s$, i, 1))
sum = sum + d: prod = prod * d
NEXT
IF sum * prod = n THEN
PRINT n, sum; prod
END IF
NEXT
finds only the same
135 9 15
144 9 16
as Jer.

Posted by Charlie
on 20100621 14:22:24 