Substitute each of the capital letters in bold by a different base ten digit from 0 to 9, such that:
- THAT is a perfect square, and none of T and I is zero, and:
- The base ten representation of the product (THIS)*(THAT)*(IT) has no leading zeroes and contains each of the digits from 0 to 9 exactly once.
I found the only solution of
5693* 5625* 95= 3042196875
with 5625=75^2
with the following code
CLS 0
DIM dcnt(0 TO 9)
FOR t = 1 TO 9
FOR h = 0 TO 9
IF h <> t THEN
FOR a = 0 TO 9
IF a <> t AND a <> h THEN
FOR i = 1 TO 9
IF i <> t AND i <> h AND i <> a THEN
FOR s = 0 TO 9
IF s <> t AND s <> h AND s <> a AND s <> i THEN
this# = s + 10 * i + 100 * h + 1000 * t
that# = t + 10 * a + 100 * h + 1000 * t
it# = t + 10 * i
num# = this# * that# * it#
IF INT(SQR(that#)) = SQR(that#) THEN
FOR j = 0 TO 9
dcnt(j) = 0
NEXT j
fail = 0
num2# = num#
FOR j = 1 TO 10
digit# = num2# - 10 * INT(num2# / 10)
IF dcnt(digit#) = 1 THEN
fail = 1
END IF
dcnt(digit#) = 1
num2# = (num2# - digit#) / 10
NEXT j
IF fail = 0 AND digit# <> 0 THEN
PRINT STR$(this#) + "*" + STR$(that#) + "*" + STR$(it#) + "=" + STR$(num#)
PRINT STR$(SQR(that#)) + "^2 = " + STR$(that#)
END IF
END IF
END IF
NEXT s
END IF
NEXT i
END IF
NEXT a
END IF
NEXT h
NEXT t
|
Posted by Daniel
on 2009-06-19 12:55:27 |