Программа.
A=13 'минимальная разница в возрасте
for x1=7 to 17
for y1=x1+A to 100
s1=x1^2+y1^2
for x2=1 to 6 '54 решения
for y2=x2+A to 100
s2=x2^2+y2^2
if s1=s2 then
print x1,y1,x2,y2,s1
end if
next y2
next x2
for x2=18 to 90 '333 решения
for y2=x2+A to 100
s2=x2^2+y2^2
if s1=s2 then
print x1,y1,x2,y2,s1
end if
next y2
next x2
next y1
next x1