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?
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.
Add (o2) 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 nijk in the magic cube is: nijk = o2((row1i + column1j + pillar1k) mod o) + o((row2i + column2j + pillar2k) mod o) + ((row3i + column3j + pillar3k) 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:
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.