Table of Contents About the Author What's new Abstract Main Results The Transformation Method The Permutation Method The Intermediate Square Method Enumeration Programs Some References Notations, Definitions & Conventions An Example of Enumeration Programs Magic Squares of Order 4 Magic Squares of Order 5 Magic Squares of Order 6 Magic Squares of Order 7
Structure of Magic and Semi-Magic Squares,
Methods and Tools for Enumeration
by Francis Gaspalou

1. Pandiagonal Squares

In 1998, I wrote a program in Turbo Pascal to calculate pandiagonal squares of order 7 (reduced program/2 352 and with 24 parameters). On a K6 computer running at 200 MHz, this program worked correctly (I had made many tests), but it didn't give solutions! I had solutions only if I fixed starting conditions in a domain where I knew there were solutions. In 2004, on a Duron running at 1.4 GHz, the same program translated in C was much more faster but still didn't give solutions.

I think there are too many cases to examine: the limits of existing personal computers are reached, even if my program isn't optimized.

Note # 1: I remember that the pandiagonal squares of order 7 haven't a group structure. The order of group G is probably 2 352, but I am not absolutely sure. See page The transformation method, § 4.3 and § 4.4. It is for me an open question.

Note # 2: a program with 23 imbricate loops works correctly for order 6 (see Appendix 5, § 1) when you search orthogonal squares to Latin diagonal squares. I think the reason is the number of cases to examine which is smaller.

2. Symmetrical Pandiagonal Squares

If the enumeration of pandiagonal squares is not possible today with personal computers, on the contrary the enumeration of symmetrical pandiagonal squares is possible (program with only 12 parameters).

  • The number of symmetrical pandiagonal squares was first calculated by Walter TRUMP in 2001 with a reduced program/48 written in GB32, a German programming language (see Walter TRUMP's site).

    On this site, you will see that I found in June 2004 the same result in 12 days with a program in C running on a Duron 1.4 GHz and with a reduced program/96.

    It is sure that the order of group G is 96 because the number of elementary squares found with a reduced program/96 is a prime (cf. Walter TRUMP's site).

    I can explain how I found the new transformation W of order 2 that allowed me to have a reduced program/96 (the other 48 transformations of group G are transpositions).
    I found transformation W occasionally in August 2000, when trying to compute the number of semi-regular symmetrical pandiagonal squares.
    I had a reduced program/48 with A1 equal to the minimum of the 24 values in the 2 diagonals, fourth column and fourth row, and with A7< G1). I computed the numbers of solutions for different values of A1 and A2, specially at the border of domain (A1, A2) where the number of solutions is very low. I found 5 solutions for A1=8 and A2=49, and 3 solutions for A1=8 and A2=48. I examined these squares and found that the transformation W between the first square (A1=8, A2=49) and the first square (A1=8, A2=48) was very simple.
    These two squares are (I give only the first row for each one):
    849427313917and
    848432313517.
    When writing the conditions of transformation W (in function of the 12 parameters), I found identities. Therefore, W was a transformation for any symmetrical pandiagonal square.

    I give the matrix of definition and the graph of W:

    A1F3A3E4A5F5A7
    C6C3G2B4G6C5C2
    C1B7B2G4B6B1C7
    D5D2D7D4D1D6D3
    E1F7F2A4F6F1E7
    E6E3A2F4A6E5E2
    G1B3G3C4G5B5G7

    I tried to identify the group of order 96 and the subgroup of order 48 among the well-known groups in the literature: I wasn't successful. I only found some abstract definition relations.

    Question: can anyone identify these groups?

  • I calculated in August 2004 the number of semi-regular symmetrical pandiagonal squares. See page The intermediate square method, § 6.

    Note: for these squares, a group G' (permutations) of order 8 operates - besides the group G (transformations) of 96 - , the symmetry about the centre being common to the transformations. Finally, a semi-regular symmetrical pandiagonal square generates:
    96 * 4 = 384 squares generally,
    96 * 2 = 192 squares sometimes.

    The number of regular symmetrical squares can be easily calculated: 27 648 squares are found (576 elementary squares with the above group G of order 48; the transformation W is an external transformation to the set).

  • Irregular symmetrical pandiagonal squares are the most numerous, regular or semi-regular squares are the exception.
    I remember that for irregular squares, the sum of capital letters is different from 147 with A=0, B=7, C=14,..., G=42.
    I searched irregular symmetrical pandiagonal squares with a maximum number of irregular lines (i. e. rows, columns or broken diagonals). I found in September 1998 two examples of symmetrical pandiagonal squares with 24 irregular lines (24 is the maximum for a symmetrical pandiagonal square, because the 2 diagonals, the 4th row and the 4th column can't be irregular):

    1472729391517
    4412132844826
    1932144220435
    9403425161041
    457308361831
    242462237386
    3335112123349
    122472337405
    3335181961648
    124274130394
    36212625242914
    461120943838
    2344431321517
    4510132732849

    Question: is it possible to find a pandiagonal square of order 7 with 28 irregular lines?
    It is maybe possible. If I have time, I will apply the same method as for symmetrical pandiagonal squares to try to find examples.