Solve this alphametic, where each of the capital letters in bold represents a different decimal digit from 0 to 9. Each of S and T is nonzero.
√(SEE) = √(THE) + √( TOP)
used the following code to find
sqrt(588)=sqrt(108)+sqrt(192)
and this works because sqrt(588)=14*sqrt(3) sqrt(108)=8*sqrt(3) and sqrt(192)=6*sqrt(3)
CLS 0
FOR s = 1 TO 9
FOR e = 0 TO 9
IF e <> s THEN
FOR t = 1 TO 9
IF t <> s AND t <> e THEN
FOR h = 0 TO 9
IF h <> s AND h <> e AND h <> t THEN
FOR o = 0 TO 9
IF o <> s AND o <> e AND o <> t AND o <> h THEN
FOR p = 0 TO 9
IF p <> s AND p <> e AND p <> t AND p <> h AND p <> o THEN
v1 = 100 * s + 11 * e
v2 = 100 * t + 10 * h + e
v3 = 100 * t + 10 * o + p
IF SQR(v1) = SQR(v2) + SQR(v3) THEN
PRINT v1; v2; v3
END IF
END IF
NEXT p
END IF
NEXT o
END IF
NEXT h
END IF
NEXT t
END IF
NEXT e
NEXT s
|
Posted by Daniel
on 2009-05-21 15:58:25 |