Harvey Heinz has written an excellent summary of magic cubes on his Magic Cube site. There are several ways to make them. This page will show how cubes of prime order can be easily constructed using master base lines. I do not believe this approach is discussed elsewhere, however, the cubes are easily constructed by other approaches. There are also many cubes and other magic figures that cannot be made using master base lines and these for the most part will not be discussed.

The *Order-3 Magic Cubes* table shows one of the four unique order-3 magic cubes. These cubes are not pan-diagonal. All rows, columns, and pillars add to the magic constant, S. The four cube diagonals also add to S, but most square diagonals and broken diagonals and most broken triagonals do not. The cube is associated. There are 48 different aspects of each of the four unique cubes.

The magic cube is constructed from three base cubes and each of the base cubes is constructed from the (mod 3) addition of three base lines. The base lines all contain a 0, a 1, and a 2. Notice the pattern of the base lines in the example shown. In each set the numbers in two of the base lines ascend and the other descends. The one that descends controls a different axis in each base cube. The base lines do not need to be this symmetric.

The base lines can all be changed to make other magic cubes. Each base line set controls just the base cube below it. The magic cube and master base lines will also be affected. The triagonal, row, column, and pillar checks at the bottom will indicate if those sets of lines all add properly. There is no check for uniform integral distribution so the cube could be wrong even if the agonals add correctly. It must be verified that all numbers from 1-27 are present in the cube.

Can you make the other three magic cubes by adjusting the base lines?

Hints

- The other cubes have as their smallest cube corner numbers 2, 4, and 6.
- A 1 must be in each of the central squares of the base cubes (Highlighted in yellow). This results in a 14 in the central square of the magic cube.
- Only a few base lines need to be changed to make each of the other cubes (at most three).

One of the many possible solutions can be found on the Answers page.

Like the order-3 cube, it is not possible to make order-5 nasik cubes. In fact it is only recently that order-5 cubes that have all 4 main triagonals and 30 main diagonals equal to the magic constant have been made. See Walter Trumps' Site. These cannot be made using base lines. It is likely that cubes like the order-3 above can be made for order-5 but I made no attempt, as my goal is pan-magic figures.

It does not appear that pan-2-agonal cubes of order-5 can be made using base lines but it is possible to make order-5 pan-3-agonal magic cubes from three base cubes that are in turn made from three quinary base lines. Each base cube is built from three identical base lines although some base lines in a set must be in reverse order. One base cube must be multiplied by 25 and a second multiplied by 5 before adding them together to make the magic cube.

A quinary base cube for the above type of magic cube can be made from any combination of 01234 and its reversed form 04321. The numbers in each series can be shifted as well. Quinary base cubes can also be made from any combination of 02413 and its reversed form 03142. These series are derived from x mod 5 and 2x mod 5.

There are three order-5 pan-3-agonal magic cubes available above. Notice that the numbers in the first two are all ± 4 or less apart. The first is just pan-3-agonal while the second is also associated. The third has numbers that are quite different from the other two. It is also associated and pan-3-agonal.

The *CubeLines* Excel Spreadsheet available on the Downloads page contains a worksheet with the order-5 cubes shown above. That download also displays sums.

When base cubes are made from three sets of base seven base lines, both order-7 pan-3-agonal and pan-2-agonal magic cubes can be made, but not nasik cubes. The pan-3-agonal cubes as above are made using three identical base lines while the pan-2-agonal squares require three different base lines, x mod 7, 2x mod 7, and 3x mod 7 with x from 0 to 7. Again, for some base cubes, some base lines must be in reverse order.

In the *Order-7 Pan-Magic Cubes* generator there are demonstrated four cubes. The first two are pan-3-agonal cubes. The first is just pan-3-agonal while the second is associated. The last two cubes are pan-2-agonal magic cubes. Again, the first is just pan-2-agonal while the second is associated. The association property also requires that the main triagonals of the last cube add to S.

The *CubeLines* Excel Spreadsheet available on the Downloads page contains a worksheet with the order-7 cubes shown above. That download also displays sums.

An order-11 magic cube can be nasik, pan-2,3-agonal, as well as just pan-3-agonal or just pan-2-agonal. The *Order-11 Pan-Magic Cubes* generator above will make 6 different order-11 magic cubes. The first two are nasik, the first simple and the second is associated. These are made using three different base lines, x mod 11, 2x mod 11, and 4x mod 11 with x from 0 to 11 for the first and 3x mod 11, 2x mod 11, and 4x mod 11 for the second. Some base lines are reversed.

Cubes 3 and 4 are pan-3-agonal, the first being simple the second associated. As usual, three identical base lines in a base cube will create this effect but it is not necessary that all three base cubes be made this way. Two of the base cubes can be nasik but one must contain identical base lines to break some 2-agonals. This was done for cube 3.

Cubes 5 and 6 are pan-2-agonal. As usual, the first is simple and the second associated. Like the nasik cubes, the pan-2-agonal squares must be made using three different base lines. Some combinations of 3 lines will give nasik base cubes while others give just pan-2-agonal base cubes. For these cubes, the three different base lines, x mod 11, 2x mod 11, and 3x mod 11 with x from 0 to 11 were used to obtain the pan-2-agonal base cubes. These were combined with nasik base cubes to make the magic cubes.

The last two cubes were made be Barnard over a century ago. They can be made using base lines as described above but they were more likely made using a 3-D modification of the Graeco-Latin squares approach. The two approaches can give the same magic cubes just as they can give the same magic squares.

The *CubeLines* Excel Spreadsheet available on the Downloads page contains a worksheet with the order-11 cubes shown above. That download also displays sums.

For larger prime numbers, o ≥ 13, an order-o magic cube made from three sets of three base o base lines can be nasik like the order-11 cube. Pan-3-agonal or pan-2-agonal cubes can also be constructed as above. In order to be nasik the base cube is constructed from three different base lines. Not all combinations of three different base lines will give nasik base cubes. Some combinations just give pan-2-agonal cubes as noted above.

Nasik magic cubes are constructed from three different nasik base cubes. Not all such combinations will yield a valid magic cube. Combinations must be checked for uniform integral distribution. If a set of three base lines generates a nasik base cube then that set of base lines can be used to generate two more base cubes that will combine to give a nasik magic cube. I believe that the following will always give a valid magic cube of order-o although I have not worked out a proof.

- Make three base lines for a nasik base cube of order-o using the series: x mod o, 2x mod o, and 4x mod o with x from 0 to o-1.
- Call the base lines for the initial nasik base cube of order-o: row1 = a; column1 = b; pillar1 = c.
- Make the base lines for the second nasik base cube: row2 = b; column2 = c; pillar2 = a.
- Make the base lines for the third nasik base cube: row3 = c; column3 = a; pillar3 = b.

Add (o^{2}) x (the first base lines) + (o) x (the second base lines) + (the third base lines) to get the master base lines. The value at position n_{ijk} in the magic cube is: n_{ijk} = o^{2}((row1_{i} + column1_{j} + pillar1_{k}) mod o) + o((row2_{i} + column2_{j} + pillar2_{k}) mod o) + ((row3_{i} + column3_{j} + pillar3_{k}) mod o).

The combination x mod o, 2x mod o, and 4x mod o with 0 ≤ x < o should always yield a nasik base cube. Other combinations will also but those other combinations have not been fully defined. This works with all prime orders I have tested. I have not confirmed that it works with composite orders as even the smallest, an order-35 cube, is difficult to analyze.

It is fairly straightforward to determine which base line combinations do not produce nasik cubes and thus by exclusion determine which combinations are nasik. The procedure for order o is given below:

- Select two base lines of order o: rx mod o and sx mod o with x from 0 to o-1, r > s, and r and s < o/2.
- Construct the lines (r+s)x mod o and (r-s)x mod o. These will be the main diagonals of the first square in the cube. They cannot be the third base line because the diagonal and the base line would be in resonance.
- Select the third cube base line, t, such that t ≠ r, s, (r+s), or (r-s) with t < o/2.
- Construct a base cube using the base lines rx mod o, sx mod o, and tx mod o. All such cubes will have nasik properties and can be combined with other nasik base cubes to make nasik magic cubes.

By swapping numbers in the base cubes, i.e. by making all the threes ones and all the ones threes, new base cubes are created. Multiple exchanges are permitted. Any two base cubes can be combined to to make pan-magic cubes. The new base cubes and magic cubes cannot be constructed directly from base lines, however.