Determine all 6 digit perfect squares such that the first three digits form a perfect square as do the last three.
The square formed by the first three digits may not have leading zeroes.
(In reply to
Solution - brute force by andre)
Yes, I get these five also:
DEFDBL A-Z
minb = -INT(-SQR(100000))
maxb = INT(SQR(999999))
PRINT minb; maxb, minb * minb; maxb * maxb
FOR b = minb TO maxb
n1 = VAL(LEFT$(LTRIM$(STR$(b * b)), 3))
n2 = VAL(RIGHT$(LTRIM$(STR$(b * b)), 3))
sr = INT(SQR(n1) + .5)
IF sr * sr = n1 THEN
sr = INT(SQR(n2) + .5)
IF sr * sr = n2 THEN
PRINT b, b * b
END IF
END IF
NEXT
b b^2
380 144400
475 225625
506 256036
570 324900
759 576081
Edited on August 26, 2008, 12:14 pm
|
Posted by Charlie
on 2008-08-26 11:50:39 |