# ORDER-2p SQUARES

For the order-4 pan-magic squares only the A0, B0, and B1 base lines could be used to make the base squares and the resulting magic squares all have the same features. For the larger order-2p pan-magic squares the C, D, etc. base lines become available as long as their base line units are equal to or shorter than the square's order. Only two base lines are needed for each base square. Therefore, some of the available base line letter types are left out of any given base square and possibly left out of all of the base squares in the final pan-magic square.

Each lettered base line type carries certain properties with it that are different than the properties of the other lettered base line types. For instance, the A0 base line always alternates between a 0 and a 1. This means that, regardless of what base line goes in the other direction, a base square with an A0 base line in one direction has two 0's and two 1's in every 2x2 square within it. This is equivalent to calling the base square compact. If an A0 base line is used to construct every base square of a magic square, then the magic square will be compact. Features are discussed in more detail below.

## ORDER-8 PAN-MAGIC SQUARES

The order-8 base squares can be made using A, B, and C base lines. Rules for making order-8 base squares are similar to those for making the order-4 base squares except that any pair of A, B, and C base lines may be used. There are 52 possible order-8 base squares that can be made using the A, B, and C base lines compared to only 4 for the order-4.

Six base squares must be combined to make an order-8 pan-magic square making 52!/46! possible magic squares. This compares to only 24 for the order-4 case, but for the order-4 case, all 24 were valid magic squares although most were redundancies. For the order-8 pan-magic squares, most potential combinations do not yield valid magic squares. It will therefore be necessary to check for uniform integral distribution after the addition of each successive base square.

Shown below are the master base lines for nine order-8 pan-magic squares. These can be converted to magic squares using the accompanying converter. The squares all exhibit different features. Some of them are unique while others are probably comparable to squares created elsewhere. Brief descriptions of their features are given just below. Base line control of the features is discussed at the bottom of this page. Just enter the squares number in the master base line set box to get a square with the desired features.

Once an order-8 pan-magic square is completed, it can be converted to 719 additional magic squares that have the same properties. This is done by rearranging the base squares into any of the 6! possible Base Square Orders. To do this in the base square generator below, enter the numbers from 1-6 in any order. There must be no repetitions as that will result in uneven integral distribution. When the numbers are in numerical order, the numbers in the top row and left column of the square will be one more than the numbers in the master base lines in the table at right. This is because the numbers in the magic square are in the traditional range for magic squares rather than the analytic range used for the calculations. This is done by adding to 1 to all the numbers in the analytic magic square that is naturally generated.

 Square 1 0 46 1 30 49 31 48 47 0 57 2 53 14 55 12 59 Square 2 0 56 61 5 19 43 46 22 0 25 59 34 44 53 23 14 Square 3 0 31 34 61 36 59 6 25 0 47 24 55 17 62 9 38 Square 4 0 28 45 49 3 31 46 50 0 26 51 41 36 62 23 13 Square 5 0 15 24 23 56 55 32 47 0 57 5 60 7 62 2 59 Square 6 0 20 58 46 21 1 47 59 0 40 53 29 42 2 31 55 Square 7 0 59 7 60 1 58 6 61 0 31 56 39 8 23 48 47 Square 8 0 61 27 38 28 33 7 58 0 47 26 53 34 13 56 23 Square 9 0 2 45 47 22 20 59 57 0 1 30 31 41 40 55 54 Square 10 7 41 26 52 0 46 29 51 13 0 30 19 53 56 38 43

Square 1 is complete and {2compact2,5}. (I will use Aale de Winkel's nomenclature for compact features. The superscript is the number of dimensions in the figure and the subscript is the size, in this case the corners of all 2x2 and all 5x5 sub-squares add to the same sum.) The square also has an unusual feature that I have not seen elsewhere. Do you see it? It is not related to sums. See the answer page for a solution.

Square 2 is complete and {2compact3,5}. It has {zigzag2} lines. See features for a description. There is also special a feature of the second magic square. None of the 2x2 squares add to S/2. This is not merely a function of having no A0 base lines. A base square composed of a B and a C base line will have half of its 2x2 squares sum to S/2. Most magic squares constructed from base squares made with only B and C base lines will have many but not all 2x2 squares add to S/2. Careful selection of base squares is required to ensure that no 2x2 squares add to S/2, making an anti-compact magic square.

Square 3 is associated and {2compact2}.

Square 4 is associated and {2compact3}.

Square 5 is a most-perfect ({2compact2} and complete) order-8 magic square with Franklin bent diagonals. Both Franklin V and W shaped bent diagonals are present.

Square 6 is a magic square with Franklin bent diagonals that is not {2compact2}. It is, however, {2compact3} and it has {zigzag2} lines. It is possible to make pan-magic squares with Franklin bent diagonals and no compact or complete feature.

The major feature of square 7 is the order-4 pan-magic square in each quadrant. It is also {2compact2} and has Franklin V but not W bent diagonals.

Square 8 also has four inlaid order-4 magic squares but not in the quadrants. One is centered in the larger square. The others are adjacent. The order-4 squares can be shifted to the quadrants by shifting both base lines by 2. This moves the 0 from the upper left corner, however.

Square 9 is complete, {2compact3,5} and has {zigzag2} lines. Groups of 4 consecutive numbers are in 2x2 blocks. If each of the 2x2 blocks is summed the resulting sums form an order-4 pan-magic square. The upper left corner of each block is also an order-4 pan-magic square. The other 3 corners likewise.

The last square was contributed by Aale de Winkel. It is complete and {2compact5}. In its original form it is also bimagic. For most of the other squares above, rearranging the base square order results in a new magic square with the same features as the original. With this square, rearranging the order loses the bimagic property. Also notice that the one is not in the upper left corner. The bimagic property is lost if the square is translated.

Rearranging the Base Square Order in squares 1 and 9 will change the groups of 4 numbers in 3x3 and 2x2 squares respectively. With the correct rearrangement the numbers in the groups can be spaced 2 apart or 4 apart or 8 or 16. Can you do that? Think about the base square multipliers. See the answer page for a solution and explanation.

The SquareLines Excel Spreadsheet available on the Downloads page contains the master base lines above. It also contains interpreters to convert the master base lines to their respective magic figures in base ten and it shows the sums for all the features. The magic figures are highlighted in yellow in the individual worksheets. The individual base lines of the figures are also shown at the bottom of the worksheets.

The Order-8 pan-magic square generator is capable of making all the order-8 magic squares that can be made using master base lines. There are some special features listed above that will only be generated by accident in the generator as they take finer control. The squares are generated randomly based on the feature choices.

## ORDER-16 PAN-MAGIC SQUARES

Doubling the size of the square greatly increases the number of magic squares that can be made and the number of features that can be exploited. With order-16, the 128 D type base lines are available. There are 2868 base squares to chose from. Eight base squares must be combined in order to make the magic square making 2868!/2860! possible magic squares. Most are not valid but the remainder that are comprise a diverse group of squares. There are 8!, 40320, different base square orders for each of the master base line sets below. All will be valid magic squares with the same features.

Base line characteristics required to express the features of the order-16 squares are discussed below. They are generally the same for all order-2p squares. Some are order dependent The larger squares allow the inclusion of more attributes in any given square. Some features however are mutually exclusive.

There are fourteen order-16 squares available from the order-16 pan-magic square generator below. These are accessed by entering the square number in the Master Base Line Set box. Each square is made from 8 base squares. The order of the 8 base squares can be rearranged to make 8! different magic squares with the same properties as the original. Do this by entering a different order of the numbers 1 to 8 in the Base Square Order boxes. There can be no repeats as this will yield redundant numbers in the square.

The first three sets of master base lines in the order-16 table are like the first two in the order-8 table. They demonstrate control of the types of compact in squares that are complete. The next three demonstrate the same control in squares that are associated. Sets 7 to 9 all generate magic squares with more that four inlaid magic squares.

Square 1 is complete and {2compact2,9}. In addition, it has an order-8 pan-magic square in each of its quadrants and all of the Franklin bent diagonals in both the big square and smaller squares add correctly.

Square 2 is complete. {2compact3,9} and {zigzag2}. None of the 2x2 squares add to S/4 making it anti-{2compact2}.

Square 3 is complete, {2compact5,9} and {zigzag2,3}. None of the 2x2 squares or corners of 3x3 squares add to S/4 making it anti-{2compact2,3}.

Square 4 is associated and {2compact2}. It has an order-8 pan-magic square in each of its quadrants.

Square 5 is associated and {2compact3}. It has an order-8 pan-magic square in each of its quadrants.

Square 6 is associated and {2compact5}.

Square 7 contains eight order-8 inlaid magic squares. The four in the quadrants are associated.

Square 8 contains sixteen order-8 inlaid magic squares. The four in the quadrants are complete. Square 8 is also {2compact2} and contains all the Franklin bent diagonals in both the order-8 and order-16 squares.

Square 9 is {2compact2} and contains 16 order-4, 16 order-8, and 16 order-12 pan-magic squares. It also contains the V shaped Franklin bent diagonals in both the order-8 and order-16 squares. The W shaped Franklin diagonals are present in the order-16 and the order-8 squares that are in the quadrants.

Square 10 is complete, {2compact2} and contains all Franklin bent diagonals. Numbers in each series 1+4x, 2+4x, 3+4x, 4+4x are at the corners of 3x3 squares for 0 ≤ x ≤ 63.

Square 11 is {2compact3}, {zigzag2}, and contains all Franklin bent diagonals. It contains order-8 pan-magic squares in the quadrants that are {2compact3}. Numbers in each series 1+4x, 2+4x, 3+4x, 4+4x are in 2x2 blocks for 0 ≤ x ≤ 63. An order-8 pan-magic square can be made from the blocks. It is compact, complete, and contains all Franklin diagonals. The upper left corner of each block makes a similar square. Ditto, the other three corners.

Square 12 is complete, {2compact5,9}, and {zigzag2,3}. Numbers in each series 1+4x, 2+4x, 3+4x, 4+4x are in 2x2 blocks for 0 ≤ x ≤ 63. An order-8 pan-magic square can be made from the blocks. It is complete and {2compact3,5}. The upper left corner of each block makes a similar square. Ditto, the other three corners. Numbers in each series 1+4x to 15+4x are in 4x4 blocks for 0 ≤ x ≤ 15. An order-4 pan-magic square can be made from the blocks. This is also true for squares constructed from numbers taken from the same fixed positions within the fifteen blocks.

One more puzzle. It is possible to change the base square order so that the numbers from 1 to 16 are in numerical order, left to right top to bottom. Can you figure out how to do it? What will happen to the sums in the inlaid square? What about their other features? See the answer page for a solution and explanation.

Square 13 is associated and {2compact2}. Numbers in each series 1+4x, 2+4x, 3+4x, 4+4x are at the corners of 5x5 squares for 0 ≤ x ≤ 63.

The last square breaks the rule that a magic square cannot be both associated and complete, however, it is not truly a magic square as it contain four of every number from 0-63. One more base square can be added and still maintain the duality but addition of the last base square must break it in order to maintain uniform integral distribution. If all the even or all of the odd numbered rows and columns are removed a compact complete order-8 pan-magic square remains. If rows and columns 2,4,6,8,9,11,13, and 15 or 1,3,5,7,10,12,14, and 16 are removed a compact associated pan-magic square remains. The base square order must end with 3, 4, 5, 6, 7, 8 as any other order will disrupt the duality feature. The first two base squares are blank as displayed.

As with the order-8 squares, rows or columns spaced 8 apart may be exchanged to give new order-16 pan-magic squares. Some properties such as bent diagonals and inlaid squares are lost. Switching columns spaced 2 or 4 apart may retain the order-4 or order-8 inlaid squares respectively but it may effect properties of the larger squares. There are many other combinations of features for order-16 magic squares that were not discussed above. Some are possible some are not. The table is just a starting point. The Order-16 pan-magic square generator allows for additional exploration of possibilities but is not exhaustive. This generator may load slowly.

The SquareLines Excel Spreadsheet available on the Downloads page contains the master base lines used in the above square generator. It also contains interpreters to convert the master base lines to their respective magic figures in base ten and shows the sums of the features. The magic figures are highlighted in yellow in the individual worksheets. The individual base lines of the figures are also shown at the bottom of the worksheets.

## ORDER-32 PAN-MAGIC SQUARES

Doubling the size of the square again increases the number of magic squares that can be made and the number of features that can be exploited. With order-32, the 32,768 E type base lines are available. There are 9,112,372 base squares to chose from. Ten base squares must be combined in order to make the magic square making 9,112,372!/9,112,362! possible magic squares. Most are not valid but the remainder that are, comprise a diverse group of squares.

Most of the features have similar descriptions for the order-32 as they did for order-16 and order-8 squares. As the squares get larger additional features become possible and the possible combinations multiply.

There are ten order-32 squares available from the order-32 pan-magic square generator below. These are accessed by entering the square number in the Master Base Line Set box. Each square is made from 10 base squares. The order of the 10 base squares can be rearranged to make 10! different magic squares with the same properties as the original. Do this by entering a different order of the numbers 1 to 10 in the Base Square Order boxes. There can be no repeats as this will yield redundant numbers in the square.

The first four order-32 magic squares demonstrate control of the different compact features in squares that are complete. The next four demonstrate that control in squares that are associated. The next five demonstrate compact control with optimum inlaid squares.

Square 1 is complete, {2compact2,17}, and contains 16 order-16 and order-24 and 36 order-8 pan-magic squares. The order-8 and order-16 squares have all Franklin bent diagonals.

Square 2 is complete, {2compact3,17}, {zigzag2}, and contains 16 order-16 and order-24 and 36 order-8 pan-magic squares.

Square 3 is complete, {2compact5,17}, {zigzag2,3}, and contains four order-16 inlaid magic squares, one of which is centered, and the others filling the remaining space. The inlaid squares can be moved to the larger squares quadrants by translating both axes by 8.

Square 4 is complete, {2compact9,17}, {zigzag2,3,5}, and contains 36 inlaid order-8 pan-magic squares.

Square 5 is associated, {2compact2}, has all Franklin V, W, and WW bent diagonals, and contains 16 order-8, order-16, and order-24 inlaid pan-magic squares

Square 6 is associated, {2compact3}, has all Franklin V, and W bent diagonals, and contains 64 order-8, order-16, and order-24 inlaid pan-magic squares.

Square 7 is associated, {2compact5}, {zigzag2}, has all Franklin V bent diagonals, and contains 4 order-16 inlaid pan-magic squares.

Square 8 is associated, {2compact9}and contains 4 order-16 inlaid pan-magic squares.

Square 9 has 64 order-4, 8, 12, 16, 20, 24, and 28 inlaid pan-magic squares. It is {2compact2} and has all the Franklin bent diagonals in the main square and in lower order-2p squares. The order-24 squares also have Franklin V bent diagonals.

Square 10 has 16 order-8, 16, and 24 inlaid pan-magic squares. It is {2compact3}, {zigzag2}, and has all Franklin bent diagonals in the main square and in lower order-2p squares. The order-24 squares also have Franklin V bent diagonals.

Square 11 has 16 order-8, 16, and 24 inlaid pan-magic squares. It is {2compact5} and has all Franklin bent diagonals in the main square and in lower order-2p squares. The order-24 squares also have Franklin V bent diagonals. The order-8's are all complete.

Square 12 has 24 order-8 and 4 order-16 inlaid pan-magic squares. The order-16 squares are complete. It is {2compact9} and has all Franklin bent diagonals in the main square and the order-16 squares. Only the V shaped Franklin diagonals in the order-8 squares are OK. The 16 order-8 squares made by dividing the main square into sixteen 8x8 pieces are {2compact2}.

Square 13 has 36 order-8 and 16 order-16 and order-24 inlaid pan-magic squares. It is complete, {2compact17} and has all Franklin bent diagonals in the main square and in lower order-2p squares. The order-24 squares also have Franklin V bent diagonals.

Square 14 is a most-perfect ({2compact2} and complete) order-32 magic square with all Franklin bent diagonals.

Square 15 has a structured order in its master base lines. This is also reflected in the appearance of the square. This structured form can be expanded easily to larger squares. Analysis of the base lines reveals this structured set. Construction of larger 2p squares, cubes, etc. using this structured approach is discussed in Überprüfen. The square is complete and {2compact2} and has all Franklin bent diagonals except the V.

Square 16 contains 64 order-8, 16, and 24 inlaid pan-magic squares. The order-8 inlaid squares made by dividing the large square into sixteen 8x8 pieces are associated. The main square has Franklin V and W bent diagonals and all the order-16 squares contain Franklin V bent diagonals.

Square 17 also contains 64 order-8, 16, and 24 inlaid pan-magic squares. The order-16 inlaid squares in the quadrants are associated. The order-8's centered in each of these are also associated. The main square has Franklin V and W bent diagonals. All the order-16 squares have Franklin V diagonals. Many of the order-8's are {2compact2}

Square 18 contains 36 order-8, 16 order-16, and 36 order-24 inlaid pan-magic squares. All are {2compact2}. The order-32 square and the centered inlaid squares are associated. The three order-16 squares that fill out the remainder of the order-32 square and the order-8's centered in them are also associated. The main square has all Franklin diagonals except the WWWW and the order-16's all have Franklin V diagonals.

The last three squares demonstrate some more unusual features. Square 19 is complete, {2compact17}, and {zigzag2}. It contains four inlaid order-8 squares centered in the quadrants that are {2compact3} and four order-16 squares that are {2compact5} and {zigzag2}. The order-16 squares are in the quadrants and thus fill the entire order-32 square, yet they are neither {2compact5} nor {2compact3}.

Square 20 is complete and {2compact9,17}. Despite not having the lower levels of compactness this square contains all four types of Franklin bent diagonals and three types of zigzag lines. In fact, it would be possible to build a square with no compact feature that still has the Franklin and zigzag features.

Square 21 contains {zigzag5} lines but not the {zigzag2} or {zigzag3} lines that should also be present. Although the order-32 {zigzag5} is usually composed of eight dotted lines of four numbers, they can also be constructed from a different set of building blocks. This square also has Franklin V, W, and WW lines.

The SquareLines Excel Spreadsheet available on the Downloads page contains the master base lines for the figures described above. It also contains interpreters to convert the master base lines to their respective magic figures in base ten. It does not contain sums but a spreadsheet with sums including inlaid squares is available from the primary author. The magic figures are highlighted in yellow in the individual worksheets. The individual base lines of the figures are also shown at the bottom of the worksheets.

Sorry, I have not developed a generator for order-32 squares. I find it better to conceive of a desired set of features and then select the base lines that will create those features in the base squares. Creating a program generally limits the possibilities. Finding base squares that combine to give uniform integral distribution is usually the hardest part of constructing the magic square.

## OTHER PAN-MAGIC SQUARES

The squares described above are not meant to cover all the possible combinations of the features described. Some combinations of features are not possible, but many others are. All it takes is an understanding of the mechanics of combining base lines and base squares. To make a square with a set of desired features.

1. Select two base lines of the same order that will produce the desired features in the base square.
2. Make a square grid the size of the lines order and place one base line in the top row and the other in the left column.
3. Fill in the base square using the exclusive OR function.
4. Repeat the first three steps to make a second base square.
5. Multiply one base square by two and add it to the second.
6. Check to ensure that the intermediate square has even integral distribution. If it does proceed to the next step, else go back to step 4.
7. Make a new base square using steps 1-3.
8. Multiply the intermediate square from step 5 by 2 and add the new base square from step 7.
9. Check for even integral distribution in the new intermediate square. If uneven integral distribution go back to step 7 and pick a new set of base lines.
10. Repeat steps 7-9 until done.

The intermediate squares can be checked to ensure that they continue to have the desired features, but if the base squares all have those features then the intermediate and final magic squares must also have them. An interactive demonstration of the above process incorporating features is available in the Feature Builder.

The same process can be applied to cubes by using a three way exclusive OR and to n-dimensional figures using an n-way exclusive OR.

## BASE LINE CONTROL OF FEATURES

For the order-4 pan-magic squares only the A0, B0, and B1 base lines could be used to make the base squares and the resulting magic squares all have the same features. For the larger order-2p pan-magic squares the C, D, etc. base lines become available as long as their base line units are equal to or shorter than the square's order. These additional base lines allow more variety in the resulting base squares and pan-magic squares. Each lettered base line type carries certain properties with it that are different than the properties of the other lettered base line types. The base square patterns created by some base line combinations exhibit different features than those created by other combinations.

### Compact Features

Compact features within a base figure are determined by a single line. Since a base square is created from two base lines a base square can have only two compact features. My definition of a compact feature is somewhat different than others. I generally consider {2compact2}, {2compact4}, and other {2compacteven number} to be a single compact feature because {2compact2} implies {2compacteven number}. See proof and inverse discussion for additional discussion and proof. Further {2compact3} implies {2compact3+4k}, {2compact5} implies {2compact5+8k}, etc. I therefore just write {2compact2}, {2compact3}, etc. with the others implied. In my system the only levels of compactness shown are 2, 2, 5, …2j+1.

 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

The A0 base line always alternates between a 0 and a 1. This means that, regardless of what base line goes in the other direction, a base square with an A0 base line in one direction has two 0's and two 1's in every 2x2 square within it. Observe the red cells in the order-8 squares at right or any other 2x2 square. All 2x2 squares in the base squares with A0 base lines add to 2. Many 2x2 squares in the third base square do not add to 2. The first two base squares are {2compact2}. If an A0 base line is used to construct every base square of a magic square, then the magic square will be {2compact2}. More generally for larger squares, sides can be independently any even length.

Both the odd numbered bits and the even numbered bits of the B type base lines alternate between 0 and 1. This means that, regardless of what base line goes in the other direction, a base square with a B type base line in one direction has two 0's and two 1's in the corners of every 3x3 square within it. Observe the yellow cells in the order-8 squares at right. This is equivalent to calling the base square {2compact3}. If a B0 or B1 base line is used to construct every base square of a magic square, then the magic square will be {2compact3}. More generally for larger squares, sides can be independently any (3 + 4k) length.

The C type base lines have their inverses spaced 4 bits apart so that the corners of every 5x5 square will have two 0's and two 1's. Examples are the green cells in the order-8 squares at right. The same effect would be seen with any of the C base lines. If a C type base line is used to construct every base square of a magic square, then the magic square will be {2compact5}. More generally for larger squares, sides can be independently any (5 + 8k) length.

D type base lines will generate base squares that are {2compact9}, E type lines generate {2compact17}, etc.

### Complete and Associated Features

 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

The complete and associated features both deal with the pairs of numbers that are complements, i.e. pairs of numbers that add to m2 + 1 in the traditional squares or m2 - 1 in the analytic. In a complete square, all such pairs are located m/2 apart on a diagonal. In an associated square, they are located at diametrically opposed positions. Since base squares have multiple 0's and 1's, a base square can be both complete and associated. Since magic squares have only one instance of each number, the two positions are mutually exclusive and a magic square cannot be both complete and associated. The complete feature is pan within the magic square. The associated feature is only applicable to the magic square shown, if the numbers are translated the associated feature is lost.

The complete feature for order-2p squares is related to the {2compactx} feature where x = (2(p-1)+1). The pairs of numbers at the opposing corners of the {2compactx} squares are complements when the square is complete. The pairs will thus consist of a 0 and a 1 in those squares. For the order-8 squares this only occurs when one of the base lines is a C type. Notice the base squares at right. The yellow cell is diametrically opposed to the green in each square and the red is located m/2 away from the green cell along a diagonal. The green and red cells are complements for the two squares containing this C base line or any C base line combined with the A base line or either B base line.

For a base square to be associated, it is necessary for numbers at diametrically opposed positions to be complements. Base lines ending in one with regular reversal intervals such as A0, B0, C0 or C6 will accomplish this reversal by themselves, but a second base line is required in the other direction. By using a base line with a center of symmetry in the other direction, the reversal is maintained. Base lines with a center of symmetry are B1, C3, and C5. All combinations of a base line from the first group with one from the second will give an associated base square as long as the two base lines do not have the same letter type. None of the squares at right satisfy the above conditions so the green and yellow cells are the same and these base squares are not associated.

### Franklin Bent Diagonals and Zigzag Lines

Franklin diagonals were discovered by Benjamin Franklin and he generated many magic squares that contain them. Order-8 examples of Franklin V and Franklin W shaped bent diagonals are shown in the figure at right. Recently my son Neil asked if it was possible to have zigzag lines like those shown at right. I found that it was fairly easy to do so.

 F N R I A L N K Z G A _ I Z G 2 F N K N R A L I

The most commonly cited example of Franklin bent diagonal has a V shape. In the order-8 square, it starts with four numbers in a diagonal starting at an edge. A 90° turn and four more numbers to the other side of the square completes the Franklin diagonal. The point of the V is two numbers on the same line so that the beginning and end of the V are on the same row or column. For a valid Franklin bent diagonal square all eight possible bent diagonals in all four directions the V can be oriented must be present. One orientation is shown at right. These diagonals are pan is the direction the V points but they are not pan laterally so the feature is lost when the square is translated.

When I say all Franklin diagonals, I also include W shaped diagonals for the order-8 squares. The W shaped Franklin diagonal starts with two numbers in a diagonal starting at an edge. A 90° turn and two more numbers, a second 90° turn and two more numbers, and a third 90° turn and two more numbers to the opposite side of the square completes W shaped diagonal. Again, there are eight bent diagonals in each of the 4 different orientations. One orientation is shown at right. In order-16 squares there are V shaped, W shaped and WW shaped Franklin bent diagonals. The order-32 square also adds the WWWW shaped, etc.

Only certain combinations of base lines result in expression of the Franklin V shaped bent diagonals. The combinations for the order-8 base squares are A0 with B0, B1, C0, C3, or C6 and B0 with C0, C5, or C6. There are no combinations of B1 with C's. Notice that the C codes that combine with A0 are multiples of 3 and that both C codes that are multiples of 5 are compatible with B0. C6 does not fit the pattern.

For order-16 base squares all combinations of A, B, and C base lines give Franklin V shaped bent diagonals. In addition, most but not all combinations of A0 with D type base lines that are divisible by 3 will give V shaped bent diagonals. Most, but not all, combinations of the B0 base line with D type base lines that are divisible by 5 will also. There are a few less predictable combinations of B0 with D type base lines that also give these bent diagonals. Most, but not all, combinations of C0 or C6 base lines with D type base lines that are divisible by 17 will give the V diagonals. There are also other less predictable combinations of C0 and C6 base lines with D type base lines. Combinations of B1, C1, C2, C3, C4, C5, and C7 with D type base lines never give V shaped bent diagonals.

For order-32 squares all combinations of A, B, C, and D base lines give Franklin V shaped bent diagonals. In addition, most but not all combinations of A0 with E type base lines that are divisible by 3 will give V shaped bent diagonals. Most, but not all, combinations of the B0 base line with E type base lines that are divisible by 5 will also. There are also some less predictable combinations of B0 with E type base lines that give these bent diagonals. Most, but not all, combinations of C0 or C6 base lines with E type base lines that are divisible by 17 will give the V diagonals. Most, but not all, combinations of D0, 24, 36, 60, 66, 90, 102, or 126 base lines with E type base lines that are divisible by 257 will also give Franklin V shaped bent diagonals. In the latter two cases, there are also many instances of base lines not divisible by 17 or 257 that will also give these bent diagonals. Combinations of the B1 base line and the C and D type base lines not mentioned above with E type base lines never give V shaped bent diagonals.

The W shaped diagonals are present in all order-8 base squares except the base squares containing the B1 code. The W shaped Franklin diagonals in the order-16 base squares have the same pattern as the V shaped diagonals in the order-8 squares for all combinations of A, B, and C codes. In addition all combinations of B0, C0, and C6 with D type base lines always give W shaped bent diagonals and combinations of B1, C1, C2, C3, C4, C5, and C7 with D type base lines never give W shaped bent diagonals.

The W shaped Franklin diagonals in the order-32 base squares have the same pattern as the V shaped diagonals in the order-16 squares for all combinations of A, B, C, and D codes. In addition all combinations of A0, B0, C0, C6, and D0, 24, 36, 60, 66, 90, 102, or 126 base lines with E type base lines always give W shaped bent diagonals and combinations of E type base lines with B1, C1, C2, C3, C4, C5, C7, or the remaining D type base lines never give W shaped bent diagonals.

All order-16 base squares except those that have a B1 base line have WW shaped Franklin diagonals. The WW shaped Franklin diagonals in the order-32 base squares have the same pattern as the W shaped diagonals in the order-16 squares for all combinations of A, B, C, and D codes. In addition all combinations of A0, B0, C0, C6, and all D type base lines with E type base lines always give WW shaped bent diagonals and combinations of B1, C1, C2, C3, C4, C5, and C7 with E type base lines never give WW shaped bent diagonals. All order-32 base squares except those that have a B1 base line have WWWW shaped Franklin diagonals.

There is a pattern to the configurations that generate The various Franklin diagonals and this pattern can be extended to larger order-2p squares. The pattern, though predictable, is complex.

Order-8 base squares can have {zigzag2} lines. Unlike the Franklin diagonals, the zigzag lines can be translated throughout the square both vertically and horizontally. The {zigzag2} lines go up and down across the square or left and right across the square like the Franklin diagonals except there is only one point on the row or column at every 90° turn. They are actually composed of two dotted lines containing four numbers that add to the same sum. By orienting the two dotted lines differently relative to each other, many other translatable groups of 8 numbers can be created. The {zigzag2} line would be just one example. I illustrate it because it is an interesting pattern.

Order-16 squares can also have {zigzag3} lines that are zigzag lines across three rows or columns and order-32 squares can have {zigzag5}. In general when a base square is {zigzag3} it is also {zigzag2} and when a square is {zigzag5} it is also {zigzag2,3}. However, there is a second mode that generates {zigzag5} and larger thus allowing them to stand alone.

{Zigzag2} lines are present in all order-8 base squares composed of a B type and a C type base line. {Zigzag3} lines are present in all order-16 base squares constructed from just B type, C type, and D type base line. {Zigzag5} lines require B type, C type, D type, and E type base line in order-32 base squares.

Base squares constructed using the A0 base line will only make {zigzag5} lines or larger. In the order-32 square, the A0 must be combined with one of the B base lines to obtain the {zigzag5} line.

### Half Rows

A common feature in Benjamin franklin's square was that the sum of each half row would add to S/2. To accomplish this each half of the base lines must have an equal number of 0's and 1's. The A0, B0, B1, C3, C5, and C6 have this property for order-8 base lines.

### Inlaid Squares

In order to obtain order-4 inlaid base squares in an order-8 base square it is necessary that each half of the base lines conform to the requirements of the smaller square, i.e. that each half of the base lines be either an A0, B0, or B1 order-4 base line. The order-8 A0, B0, B1, C3, C5, and C6 base lines fulfill this requirement. One must also ensure that the two base lines chosen do not have the same letter type order-4 base lines, i.e. the A0 and C5 base lines both have A type order-4 base lines in both their halves and will thus not generate a valid order-4 base square on combination. The A0 and C3 base lines will generate valid order-4 base squares in each quadrant because order-4 A0 and B0 base lines will be combined in each of the quadrants.

The position where the inlaid square is generated need not be in the quadrants. It can be anywhere as long as the part of the code generating the inlaid square is consistently at the same positions for all the base line pairs. This allows for placing inlaid squares in the center of the larger square or at any other position.

Features can be added to the inlaid squares as well by ensuring that those features are built into the sections of the base lines that generate those inlaid squares.

### Number Series Blocks

All the other features discussed required that the feature be present in each base square and the order didn't really matter. The order of the base squares is important for this feature. In general, the desired block is a set of four sequential numbers in a 2x2 square or at the corners of some larger square. The sequential binary numbers can be designated x00, x01, x10, and x11 where x is also a binary number that is constant for the group.

When this feature is in 2x2 blocks, all base squares except the last 2 (those multiplied by 2 and 1 before addition) must be built in 2x2 blocks. Every 2x2 block in these base squares must be all 0's or all 1's. This is accomplished by having both base lines composed of doubled 0's or 1's. For order-8 squares the B0 with either the C0 or C3 are the only options.

The last two base squares control the x00, x01, x10, and x11 series. At least one of these must alternate between 0 and 1 to ensure that the blocks are split into four numbers. The numbers in the blocks can be spaced 2 apart by making the controlling base squares the second and third from the last (those with 4 and 2 multipliers). Spacing numbers 4 apart requires that the two controlling base squares have 8 and 4 multipliers, etc.

In order to place the four numbers in the corners of 3x3 squares the initial base squares must have 0's in the first and third positions of both base lines and they must have an overall pattern consistent with alternating 0's and 1's. For order-8 squares the A0 with either the C0, C1, C4, or C5 are the only options. The last two base lines must then allow 1's in the third position of one of the base lines.

It is not possible to place the sequential numbers at the corners of 4x4 squares as the squares cannot fully fill the space of any order-2p square. It is possible for the corners of 5x5, 9x9, … (2k+1) squares to fully fill large enough 2p squares.