In this 4x4 grid, each of the capital letters in bold represents a different base ten digit from 0 to 9, such that the sum of each of the four columns as well as the sum of each of the four rows is ET.
E L M S
R E I N
A N T I
S T E P
Determine the respective minimum value and the maximum value of ET.
Note: ET is equal to 10*E+ T.
In the grid: E L M S
R E I N
A N T I
S T E P
the letter frequency is:
E T I N S L A M P R
3 2 2 2 2 1 1 1 1 1.
To determine ET
Construct a grid with descending maximum number of values from highest to lowest:
9 9 9 8 [35]
8 7 7 6 [28]
6 5 5 4 [20]
3 2 1 0 [06] Total 89
The average row and column sums are 19.75
Construct a grid with ascending maximum number of values from lowest to highest:
0 0 0 1 [01]
1 2 2 3 [08]
3 4 4 5 [16]
6 7 8 9 [30] Total 55
The average row and column sums are 13.75
The average value is then is 16.75.
The range of values for ET is therefore from 14 to 19 rendering E=1 and T values from the set {4,5,6,7,8,9}.
I failed in trying to manipulate a spreadsheet and so wrote a program which resulted in the following:
x e t l* m* s r i* n* a p
-----------------------------------
14 1 4 6 7 0 8 2 3 5 9
14 1 4 7 6 0 8 3 2 5 9
15 1 5 3 9 2 8 0 6 4 7
15 1 5 9 3 2 8 6 0 4 7
16 1 6 2 9 4 8 0 7 3 5
16 1 6 9 2 4 8 7 0 3 5
Variables above each column are used in the program and except for 'x' they are minuscles of the capitals witin the grid array.
Note too that by taking the rows above in pairs, the swapping of columns l-m at the same time as swapping column i-n values allows for the second of the pair.
There is yet another interesting point about the make up of the middle rows of those columns. Note the positioning of 0,3,6 and 9.
There is yet another thought. Consider two values within separate columns but in the same row that total 9. Look down those columns and consider the pair total.
----------------------------------------------------------------------------------------------------------------
CLS
OPEN "MGSQ.TXT" FOR OUTPUT AS #1
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR t = 0 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR l = 0 TO 9
IF used(l) = 0 THEN
used(l) = 1
FOR m = 0 TO 9
IF used(m) = 0 THEN
used(m) = 1
FOR s = 0 TO 9
IF used(s) = 0 THEN
used(s) = 1
FOR r = 0 TO 9
IF used(r) = 0 THEN
used(r) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR a = 0 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR p = 0 TO 9
IF used(p) = 0 THEN
used(p) = 1
et1 = 0
x = e * 10 + t
a1 = e + l + m + s
a2 = r + e + i + n
a3 = a + n + t + i
a4 = s + t + e + p
a5 = e + r + a + s
a6 = l + e + n + t
a7 = m + i + t + e
a8 = s + n + i + p
IF x = a1 THEN et1 = et1 + 1
IF x = a2 THEN et1 = et1 + 1
IF x = a3 THEN et1 = et1 + 1
IF x = a4 THEN et1 = et1 + 1
IF x = a5 THEN et1 = et1 + 1
IF x = a6 THEN et1 = et1 + 1
IF x = a7 THEN et1 = et1 + 1
IF x = a8 THEN et1 = et1 + 1
PRINT x; e; t; l; m; s; r; i; n; a; p
IF et1 = 8 THEN
PRINT #1, x; e; t; l; m; s; r; i; n; a; p
END IF
used(p) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(r) = 0
END IF
NEXT
used(s) = 0
END IF
NEXT
used(m) = 0
END IF
NEXT
used(l) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
*** I only glanced at Charlie's comment and I see that his program listing is similar to the above but I have yet to see how similar.
|
Posted by brianjn
on 2009-07-31 21:51:43 |