# PRIME ORDER SQUARES

Much of what will be discussed in this section is not particularly new. Euler worked with Graeco-Latin patterns to make magic squares. I create the same base square patterns by combining base lines but my method places numbers directly in the square. With the Graeco-Latin patterns, a set of numbers can be substituted for the letters in all possible ways, whereas my approach does not allow that. My approach generates a more limited set of magic squares, but because I am working with base lines, I can easily extend the concept to higher dimensions.

With quinary (base five) and larger bases, the rules developed around the binary and ternary figures of order 2p, where p ≥ 2, still apply. However, pan-magic figures can also be made using base line units of the same length as their order. This makes it possible to build pan-magic squares of order-o using base lines when o ≥ 5 and prime. The rules developed for ternary squares are still useful for constructing of order 2p, where p ≥ 2, but there are additional possibilities.

## ORDER-5 PAN-MAGIC SQUARES

With quinary base lines, it is possible to make order-5 pan-magic squares. Only two base squares are needed for these constructions. Each base square is made from two base lines. Since the shortest quinary base line unit must be five digits long, the base line unit lengths for the two base lines used to make each base square must be the same perforce. This is a notable departure from the requirements for binary base lines. Only 4 unique order-5 pan-magic line squares can be made in this way out of the 144 possible order-5 pan-magic squares identified by Grogono and others.

The illustration at right shows one of the possible order-5 pan-magic line squares. It is built from the two base squares to its left. The base lines can be altered to search for other magic line squares. Try shifting lines to the left or right with wraparound. That will change the position of the numbers but they will remain in the same position relative to each other (translations). Try making the base lines of the second square the same as the first. The sums will all be correct but the magic square does not contain all the numbers from 0 to 24 (lack of uniform integral distribution). Enter other series and see that most give incorrect sums.

There are only 4 unique magic squares that can be made using base lines. Each has eight aspects. Can you generate the other three unique squares by modifying the base lines at right? Hint. Valid base line possibilities are very limited. Can you make an associated square? For starters, this requires that a 2 is in the center of each base square. A solution is given on the Answers page.

Substituting letters for the five numbers in the patterns gives the standard Graeco-Latin square. Substituting a different number (0-5) for each of the letters and combining them in pairs will give all 144 of the recognized pan-magic squares. The base line approach is a nice mathematical method to create the basic Graeco-Latin square.

## ORDER-25 PAN-MAGIC SQUARES

There are four order-25 pan-magic squares shown on the 25x25 worksheet of the SquareLines Excel Spreadsheet available on the Downloads page. The first two master base line sets are squares made using the rules developed for ternary figures, i.e. each base square is made from two base lines that have different base line unit lengths. The second is associated, the first is not.

For both squares the sum of all numbers in every 5x5 square adds to S, i.e. they are compact for a magic square made from quinary base lines, i.e. {2compact5}25. The sum of square grids of 25 numbers spaced 2, 3, 4, 5, 6, 7, 8, 9, 11, or 12 apart within the larger square also always adds to S. These are {2compact9}25, {2compact13}25, {2compact17}25, etc. Multiple wraparounds are required for the larger spacings. A spacing of 10 is excluded from the above list only because it is redundant with a spacing of 5. Spacings larger than 12 are also valid but all are redundant with one of the smaller values, which also includes the spacing of 1.

The squares are also complete by a definition similar to that in Order-3p Squares. The sum of five numbers evenly spaced on any diagonal or broken diagonal always adds to the same value, S/5. Shifted rows and columns always add to S as well. For the order 25 squares a shifted row is 5 numbers in a row or column plus 5 numbers in a row or column that is a continuation of the first 5 numbers but shifted by 5 lines. The row or column is again shifted in the same direction to pick up the next 5 numbers, etc.

Rows or columns spaced multiples of 5 apart may also be exchanged in these first two squares retaining all features except the associated feature.

The last two order-25 pan-magic line squares take advantage of the ability to create order-5 pan-magic line squares using base lines with the same base line unit lengths.

The third order-25 square available in the generator above contains two base squares composed of 25 identical order-5 pan-magic line squares. This was done by repeating the order-5 base lines of an order-5 base square to fill in the order-25 base lines of the order-25 base square. The other two base squares use the same two base lines as the first two with one difference. One of the base lines in each pair is incremented for each group of five digits, i.e. 02413 24130 41302 13024 30241, making it an order-25 base line. The order-25 square that is created is {2compact5}25 and there are 25 inlaid order-5 pan-magic squares. All of the inlaid squares have the same magic constant.

The fourth order-25 square was generated by multiplying two order-5 squares. The multiplication was done using just the master base lines. The row master base line was made from the two order-5 master row base lines, 0, 14, 23, 7, 16 and 0, 22, 19, 11, 8. The base lines are exchanged to make the two column base lines. Multiplication is accomplished using Mi = (a + 25b) to determine the value of the 25 numbers in the base lines. The relation x = (i mod 5) for 0 ≤ i ≤ 24 determines which member of the first base line to substitute for a. The relation y = int(i/5) determines the value to select from the second base line to substitute for b. Since the order-5 squares were associated, the resulting order-25 square is also associated as are all 25 inlaid magic squares. The inlaid squares all have different magic constants.

## ORDER-o PAN-MAGIC SQUARES

In general for any odd prime order-o, except for o = 3, the two series x mod o and 2x mod o can always be used as base lines to make pan-magic base squares with 0 ≤ x < o. When o = 3 the two series are the same (one forward and one backward), thus a pan-magic square cannot be made. Order-5 squares are the smallest that can have the two different series. They are thus the smallest odd order to allow pan-magic squares to be built from base lines. More generally when o is prime, the two series rx mod o and sx mod o will create base lines that always make pan-magic base squares with 0 ≤ x < o and both r and s ≤ o/2. This assumes that the two base lines are not the same or just reversed.

To make a prime order magic line square, two order-o base squares must be combined by multiplying one base square by o and adding the second. This will always yield a pan-magic square for squares of prime order. Uniform integral distribution appears to be a given for these pairs. The only feature of import for the prime order-o squares appears to be the associated property although Walter Trump has recently discovered some interesting symmetric designs. More meat is obtained from squares of order-op when p ≥ 2. The order-o squares can also be easily derived by other means and in greater quantity.

Generators for order-7 and order-11 squares are provided at left. Except for the last one in each set (square 6 for order-7 and square 7 for order-11), they are all simple pan-magic line squares made using different base lines. Many more can easily be created. The last one of each order is associated. Making the square associated only requires that the two base lines used place the midpoint number in the center of the square (3 for the order-7 and 5 for the order-11). Base lines with that property automatically make base squares that are associated.

Notice that changing the base square order of the first three and the last order-7 magic squares just reverses the xy axes while the other two are different squares. This is because the row and column base lines of these magic squares are just reversed for the two base squares. The base line pairs for the other two magic squares are different.

The base line pairs for the order-11 squares are all different except for the associated square so that reversing the base square order creates different magic squares. However, notice that the first row for the first six squares is always the same. This is because the row base lines are always the same.