Determine all possible list(s) of
pythagorean triple (a,b,c), with 0 < a < b < c < 100, such that we will obtain another pythagorean triple (p,q,r) by inserting the same nonzero digit to the left of each of a, b and c. None of a, b and c can contain
any leading zeroes.
Note: Try to derive a non computer assisted method, although computer program/spreadsheet solutions are welcome.
FOR a = 1 TO 98
FOR b = a + 1 TO 99
FOR c = b + 1 TO 100
IF a * a + b * b = c * c THEN
FOR i = 1 TO 9
ia = VAL(LTRIM$(STR$(i)) + LTRIM$(STR$(a)))
ib = VAL(LTRIM$(STR$(i)) + LTRIM$(STR$(b)))
ic = VAL(LTRIM$(STR$(i)) + LTRIM$(STR$(c)))
IF ia * ia + ib * ib = ic * ic THEN PRINT a; b; c, i
NEXT
END IF
NEXT
NEXT
NEXT
finds
5 12 13
with the appropriate digit prefix being a 1.

Posted by Charlie
on 20081108 17:12:49 