Mathematically a composite number is an integer that is a combination of two or more primes. By that definition, the squares discussed in Order-2p Squares and Order-3p Squares and the powers of primes are composites. This section will concentrate only on composites of more than one prime, not the powers of primes. The discussion will be split into even and odd composites, as they must be treated differently.


It has been proven that squares of singly even order cannot be pan-magic. All squares of doubly even order can be pan-magic. Thus, the order-12 pan-magic squares are the smallest that will be considered here. I initially became interested in the order-12 squares during a discussion with Aale de Winkel about the implications of the compact term. I thought I had proof that {2compact4} meant that the figure was also {2compact2}. He pointed out that the proof did not work for order-12 squares. My proof was confined to order-2p figures. A further discussion of this is given below.

Order-12 base squares must be either binary or ternary. The order-12 pan-magic squares are constructed from 4 binary base squares and 2 ternary base squares. This creates a number of construction challenges. For instance, the {2compact2} feature can be expressed in the binary base squares but not the ternary base squares. Thus, it cannot be expressed in an order-12 pan-magic square made from base lines. {2Compact2} order-12 pan-magic squares can be made in other ways. There is an example below. My son Neil put together a program to create order-12 pan-magic from base lines and the examples below are largely a result of that effort. The order of the base squares can be shuffled as with the other constructions. Base squares 5 and 6 are always ternary base squares and the others binary. The base square order can be shuffled in any order to give a new order-12 pan-magic square with the same properties. There must be no repeats in the base cube order, however.

Square 1 is {2compact7}. If it were to follow the pattern based on order-2p squares, it would also be expected to be but {2compact3} and complete. It is neither.

Square 2 is just pan-magic with no special feature except a feature my son calls quadplete. This is the sum of 16 numbers evenly spaced in a grid pattern is any 10x10 sub-square within the order-12 square. Every order-12 pan-magic square I have examined has this feature.

Square 3 is {2compact7} and complete.

Square 4 has both Franklin V and what I call Franklin VW bent diagonals. The VW bent diagonals as the letters imply go back and forth three times while crossing the square. A Franklin W type bent diagonal is not possible.

Square 5 is {2compact4} but it is not {2compact2 or 6}. This square also has both Franklin V and Franklin VW bent diagonals.

Square 6 has four inlaid order-3 magic squares. They have their upper left corners at positions (4,4), (10,4), (4,10), and (10,10).

Square 7 has sixteen order-3 magic squares in a grid arrangement. Notice that the 1 is not in the upper left corner because an order-3 square cannot have its 1 in a corner. The order-12 square is also {2compact7} and complete.

The numbers in square 8 are only slightly different from those in square 7 but it is {2compact4}, not {2compact7} and not complete.


In general for any odd order-o where o is not divisible by 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. For larger odd order-o squares divisible by 3, the two series will always give incorrect diagonals in one direction. Squares that are orders that are singly divisible by 3 can be pan-magic. For instance, John R. Hendricks created an order-15 pan-magic square. It does not appear, however, that these squares can be created using base lines. Composites of two different primes ≥ 5 must be ≥ 35. Squares of these orders are relatively easy to make 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. For composite numbers not divisible by 3, the additional restriction that r and s must not be factors of o must be applied. Even with that restriction, there are many other combinations of r and s series that do not give pan-magic base squares but there are many that do.

Two order-o base squares must be combined by multiplying one base square by o and adding the second. This will not always yield a valid pan-magic square for squares of composite order but will always yield a pan-magic square for squares of prime order. Uniform integral distribution must be confirmed for the composite squares. I believe that the two base squares o(x mod o and 2x mod o) plus (2x mod o and x mod o) will always yield a pan-magic square where the series in parenthesis represent the row and column base lines needed to make the base squares.

There are four order-35 pan-magic squares shown on the 35x35 worksheet of the SquareLines Excel Spreadsheet available on the Downloads page. The first two master base line sets are squares made as described above. The second is associated, the first is not.

The third and fourth magic squares on the worksheet are made by multiplying an order-5 pan-magic square by an order-7 pan-magic square and vice versa. The same two associated pan-magic squares were used for both multiplications. Both order-35 squares are associated but the top row and left column are not master base lines. The squares cannot be made from master base lines like the order-25 multiplied squares. Multiplication of master base lines does not work unless both base lines are the same length.


{2Compact2,4,6} and Franklin V bent diagonal

There is a proof in Magic Constant Groups that if a cube is {2compact2} it is also {2compact4} or any other even number. An order-12 example that is {2compact2,4,6} is shown at right. This proof is easily extended to figures of any number of dimensions and/or order. At the time that this was originally written I thought I had also proved that a figure that is {2compact4} is also {2compact2}. However, that proof only works for figures of order-2p.

Since the proof works with any number of dimensions, the easiest number of dimensions to work with is one or a line. A simplified proof thus follows: For an order-8 line call the values a b c d e f g h. If this line is {1compact2} then a+b = b+c = c+d = d+e = etc. Since b+c = c+d then b = d. Thus by substitution a+b = a+d. Proving that the line is also {1compact4}.

As an example, for the {2compact2,4,6} square at right, let a = 33+113 = 146, then b = 16+128 = 144, c = 105+41 = 146, and d = 52+92 = 144. Thus a+b = a+d as above. The four pairs of numbers could start at any point in the order-12 square with the same result.

For the converse if the above order-8 line is {1compact4} then a+d = b+e = c+f = d+g = e+h = f+a = g+b = h+c. The last three require wraparound. Since d+g = g+b then d = b. Thus by substitution a+d = a+b. Proving that the line is also {1compact2}.

{2Compact3,7} and Franklin W bent diagonal

For an order-12 line, a b c d e f g h i j k l, {1compact2} still means that the line is also {1compact4}. It is also {1compact6} by the same logic. The converse, however, does not follow. If the line is {1compact4} then a+d = b+e = c+f = d+g = e+h = f+i = g+j = h+k = i+l = j+a = k+b = l+c. Since d+g = g+j then g = j. By substitution a+d = a+j but a and j are 4 apart which is still {1compact4}. No substitution will give a different level of compact, thus {1compact4} does not imply {1compact2}. Squares 5 and 8 in the Order-12 Pan-Magic Squares generator above illustrate this fact.

If the order-12 line is {1compact6}, however, it must also be {1compact2}. For a {1compact6} line, a+f = f+k = k+d = d+i = i+b. Therefore f = d and d = b and thus f = b and by substitution a+f = a+b.

Similarly if the order-12 line is {1compact3} then it must also be {1compact7} like the {1compact3,7} at right. To see this a+c = b+d = c+e = d+f = e+g = etc. Since c+e = e+g then c = g. Thus by substitution a+c = a+g. Proving that the line is also {1compact7}. The converse, however, does not follow, i.e. {1compact7} does not imply {1compact3}.

{2Compact4,7} and not {2Compact2 or 3}
120 122124979593121416615957

An example in the {2compact3,7} square could be 15+122 = 137. Then c would be 25+128 = 153, e would be 12+125 = 137, and g would be 22+131 = 153. Thus a+c = a+g as above proving that {2compact3} implies {2compact7}. Squares 1, 3, and 7 in the Order-12 Pan-Magic Squares generator above illustrate the fact that {2compact7} does not imply {2compact3}.

The next order-12 pan-magic square at right was contributed by Aale De Winkel. It is {2Compact4,7} but neither {2compact2} nor {2compact3}. The square is also complete and has 16 inlaid order-3 magic squares.

Generalizing, for order-4n squares, assuming that the magic square is large enough and/or wraparound is used, a square that is {2compactx} is also {2compact(2(x-1)y}. This is also true for figures of any number of dimensions.

Generally a square that is {2compact(2(x-1)y} will also be {2compactx}. But if (2(x-1)y-1) is a factor of the squares order or is an odd multiple of that factor then {2compact(2(x-1)y} does not imply {2compactx}. For example, for an order-28 square, {2compact8 or 22} does not imply {2compact2}. But if the square is {2compact2} it must also be {2compact8,22}. Seven, (8-1), is a factor of the squares order, 28, and 21, (22-1) is 7 + order/2. (15-1) is also a factor of the order and thus {2compact15} does not imply {2compact3}, but {2compact7, 11, or 19} do imply {2compact3,7,11,15,19}