Office Applications and Entertainment, Magic Squares  
Index  About the Author 
a(21) = s1  a(22)  a(23)  a(24)  a(25) a(16) = s1  a(17)  a(18)  a(19)  a(20) a(15) = 0.6 * s1 + a(17) + a(18) + 0.6 * a(21) + 0.6 * a(22) + 0.6 * a(23) + 0.6 * a(24)  0.4 * a(25) a(14) = 1.4 * s1  a(18)  a(19)  a(20)  0.4 * a(21)  0.4 * a(22)  0.4 * a(23)  1.4 * a(24)  0.4 * a(25) a(13) = 1.4 * s1  a(17)  a(18)  a(19)  0.4 * a(21)  0.4 * a(22)  1.4 * a(23)  0.4 * a(24)  0.4 * a(25) a(12) = 0.6 * s1 + a(19) + a(20) + 0.6 * a(21)  0.4 * a(22) + 0.6 * a(23) + 0.6 * a(24) + 0.6 * a(25) a(11) = 0.6 * s1 + a(18) + a(19)  0.4 * a(21) + 0.6 * a(22) + 0.6 * a(23) + 0.6 * a(24) + 0.6 * a(25) a(10) = s1  a(17)  a(18)  a(22)  a(23) a( 9) = s1 + a(18) + a(19) + a(20) + a(23) + a(24) + a(25) a( 8) = s1 + a(17) + a(18) + a(19) + a(22) + a(23) + a(24) a( 7) = s1  a(19)  a(20)  a(24)  a(25) a( 6) = s1  a(18)  a(19)  a(23)  a(24) a( 5) = 0.6 * s1  a(20)  0.6 * a(21) + 0.4 * a(22) + 0.4 * a(23)  0.6 * a(24)  0.6 * a(25) a( 4) = 0.6 * s1  a(19) + 0.4 * a(21) + 0.4 * a(22)  0.6 * a(23)  0.6 * a(24)  0.6 * a(25) a( 3) = 0.6 * s1  a(18) + 0.4 * a(21)  0.6 * a(22)  0.6 * a(23)  0.6 * a(24) + 0.4 * a(25) a( 2) = 0.6 * s1  a(17)  0.6 * a(21)  0.6 * a(22)  0.6 * a(23) + 0.4 * a(24) + 0.4 * a(25) a( 1) = 1.4 * s1 + a(17) + a(18) + a(19) + a(20) + 0.4 * a(21) + 0.4 * a(22) + 1.4 * a(23) + 1.4 * a(24) + 0.4 * a(25)
which can can be rewritten as:
a(21) = s1  a(22)  a(23)  a(24)  a(25)
The linear equations shown above, are ready to be solved, for the magic constant 65.
0 < a(i) =< 25 for i = 1, 2, ... 16, 21
which can be incorporated in the guessing routine and reduce the number of guesses, and consequently the processor time, dramatically (MgcSqr5a).
3.2 Analytic Solution, Simple Magic Squares
If the requirements for Pan Magic Squares, as discussed in section 3.1 above, are moderated till the sum of all rows, columns and main diagonals sum to the same magic constant, the applicable equations are:
a( 1) + a( 2) + a( 3) + a( 4) + a( 5) = s1
Or in matrix representation:
Or shorter:
and reduced, by means of row and column manipulations, to:

a(21) = 65  a(22)  a(23)  a(24)  a(25) a(16) = 65  a(17)  a(18)  a(19)  a(20) a(11) = 65  a(12)  a(13)  a(14)  a(15) a( 9) = a(10)  a(13) + a(15)  a(17) + a(20)  a(21) + a(25) a( 7) = (65  a( 8)  a( 9)  a(10) + a(11)  a(13) + a(16)  a(19) + a(21)  a(25)) / 2 a( 6) = 65  a( 7)  a( 8)  a( 9)  a(10) a( 5) = 65  a( 9)  a(13)  a(17)  a(21) a( 4) = 65  a( 9)  a(14)  a(19)  a(24) a( 3) = 65  a( 8)  a(13)  a(18)  a(23) a( 2) = 65  a( 7)  a(12)  a(17)  a(22) a( 1) = 65  a( 2)  a( 3)  a( 4)  a( 5)
The linear equations shown above, are ready to be solved, for the magic constant 65.
0 < a(i) =< 25 for i = 1, 2 ... 7, 9, 11, 16 and 21
which can be incorporated in the guessing routine (MgcSqr5a2).
Other magic constants are possible for both Magic Squares and Pan Magic Squares.
The last mentioned procedure (CnstrSqrs5b) counted in about 24 hours 10310400
Pan Magic Squares of the 5^{th} order with magic constant 315 for distinct integers from 1 to 125.
3.4 Rotation, Reflection, Row and Column Shifts
Rotation and Reflection (General)
Each Magic Square has 8 orientations which can be reached by means of rotation and/or reflection
(ref. Attachment 5.5.2).
Row and Column Shifts (Pan Magic)
Each Pan Magic Square of order n is part of a collection of n x n Pan Magic Squares which can be obtained by means of row and/or column shifts
(ref. Attachment 5.5.5).
Combined Rotation, Reflection, Row and Column Shifts (Pan Magic)
Consequently each Pan Magic Square of order n is part of a collection {A_{ij}^{k}} containing 8 x n x n Pan Magic Squares (ref. Attachment 5.5.5).
Each 5^{th} order Simple Magic Square corresponds with 4 transformations as described below:
Note: Secondary properties, e.g. pandiagonal, are not invariant to the transformations described above.

Index  About the Author 