In the six rows of numbers below, each of the pairs adds up to 25. Now
25 happens to be a perfect square.
Fill in the blanks with a third number (a different number in each row)
so that the sums of any two numbers on any row is a perfect square.
++++
 1 24  
++++
 2 23  
++++
 3 22  
++++
 4 21  
++++
 5 20  
++++
 6 19  
++++
DEFDBL AZ
CLS
FOR n1 = 1 TO 10
n2 = 25  n1
FOR n3 = 1 TO 999999
IF n3 <> n1 AND n3 <> n2 THEN
s2 = n1 + n3: sr = INT(SQR(s2) + .5)
IF sr * sr = s2 THEN
s3 = n2 + n3: sr = INT(SQR(s3) + .5)
IF sr * sr = s3 THEN
PRINT n1; n2; n3, s2; s3
EXIT FOR
END IF
END IF
END IF
NEXT
NEXT
finds
array the 2 added squares
1 24 120 121 144
2 23 98 100 121
3 22 78 81 100
4 21 60 64 81
5 20 44 49 64
6 19 30 36 49
Also it can be extended two more rows:
1 24 120 121 144
2 23 2 4 25
3 22 78 81 100
4 21 60 64 81
5 20 44 49 64
6 19 30 36 49
7 18 18 25 36
8 17 8 16 25
by not requiring uniqueness of numbers within a row. I think that was a misunderstanding on my part that added that requirement.
Edited on June 10, 2013, 2:29 pm

Posted by Charlie
on 20130610 13:37:54 