A super number square has the following properties:
- In each row, the rightmost number is the sum of the other three.
- In each column, the bottom number is the sum of the other three.
- Within each NW-SE diagonal line, the last number (bottom rightmost) is the product of the other numbers.
For example, if you have a square that looks like:
A B C D
E F G H
I J K L
M N P Q
you know that A+B+C=D, C+G+K=P, AFK=Q, EJ=P, and so on.
Construct a super number square in which the highest number in any position is 57, and the second number in the top row is a 5 (all numbers are positive integers).
Assuming that C must in fact be equal to H and I equal to N, we know
p=ej
l=5g
i=5g-k-j
n=5g-k-j
h=ej-k-g
c=ej-k-g
n=5g-k-j
f=ej-k-2g-e
f=5g-k-2j-5
from these last two, 7g=ej+2j-e+5
Thus various combinations of e and j produce what may or may not be valid (integral) g. We can then try various combinations of a and k to see if the product q is equal to d+h+l and to m+n+p where d=a+b+c and m is a+e+i.
Not wanting to do this by hand, I made a program:
CLS
sum = 2
DO
FOR j = 0 TO sum
e = sum - j
g = (e * j + 2 * j - e + 5) / 7
IF g = INT(g) AND g >= 0 THEN
FOR k = 0 TO 50
FOR a = 0 TO 50
IF e * j - k - 2 * g - e > 0 AND 5 * g - k - j > 0 THEN
IF a * (e * j - k - 2 * g - e) * k = a + 5 + 2 * (e * j - k - g) + 5 * g THEN
IF a + e + 5 * g - k - j + 5 * g - k - j + e * j = a * (e * j - k - 2 * g - e) * k THEN
PRINT USING "####"; a;
PRINT USING "####"; 5;
PRINT USING "####"; e * j - k - g;
PRINT USING "####"; a + 5 + e * j - k - g
PRINT USING "####"; e;
PRINT USING "####"; e * j - k - 2 * g - e;
PRINT USING "####"; g;
PRINT USING "####"; e * j - k - g
PRINT USING "####"; 5 * g - k - j;
PRINT USING "####"; j;
PRINT USING "####"; k;
PRINT USING "####"; 5 * g
PRINT USING "####"; a + e + 5 * g - k - j;
PRINT USING "####"; 5 * g - k - j;
PRINT USING "####"; e * j;
PRINT USING "####"; a * (e * j - k - 2 * g - e) * k
PRINT "-"
DO: LOOP UNTIL INKEY$ > ""
END IF
END IF
END IF
NEXT
NEXT
END IF
NEXT
sum = sum + 1
LOOP
the first several resulting arrays are:
21 5 11 37
5 3 3 11
11 3 1 15
37 11 15 63
-
19 5 9 33
5 1 3 9
9 3 3 15
33 9 15 57
-
11 5 15 31
5 6 4 15
15 4 1 20
31 15 20 66
-
9 5 10 24
5 1 4 10
10 4 6 20
24 10 20 54
-
of which the second has the desired highest number of 57.
|
Posted by Charlie
on 2003-08-19 15:53:55 |