Determine all possible values of a 3-digit non leading zeroes positive decimal integer N, such that N is obtained by multiplying its sum of the digits with the sum of squares of its digits.
I used the following code
CLS 0
FOR d1 = 1 TO 9
FOR d2 = 0 TO 9
FOR d3 = 0 TO 9
n = d3 + 10 * d2 + 100 * d1
s1 = d1 + d2 + d3
s2 = d1 ^ 2 + d2 ^ 2 + d3 ^ 2
IF n = s1 * s2 THEN
PRINT n, s1, s2
END IF
NEXT d3
NEXT d2
NEXT d1
and got the following answers
133=7*19
315=9*35
803=11*73
|
Posted by Daniel
on 2009-06-22 12:42:06 |