# MY PERSONAL CUBE HISTORY

This section is primarily a summary of my personal path to the creation and understanding of the set of nasik magic cubes, tesseracts, etc. It does not purport to be a history of other's work in the area. Until 2003, I was unaware of any of that work. To me it was just an idle hobby and the reward was just being able to make the cubes. It is only recently that I have seen that there are others like me who would have an interest in my hobby. I have tried in other sections to refer to work that I have researched in preparation of those other sections.

## THE MAKING OF THE CUBE

My first memory of an order-4 pan-magic square was in a book of math games that my mother bought for me as a child in the 50's. I remember the description included the 2X2 squares in addition to rows columns and diagonals that all added to the magic sum. It also described how rows and columns could be moved to the opposite side without changing the magic properties. Current descriptions of these squares may include other properties but are otherwise little changed. I remember the book attributed the square to the tomb of an Egyptian ruler who died at the age of 34, the magic sum. I have not seen this allusion in any current discussions and wonder if it was just a made up story or if there is some truth to it.

Years later while an undergraduate chemistry student I was listening one day to a lecture on molecular orbitals. These were being described as wavelike structures and I started to daydream about the pan-magic square. It suddenly occurred to me that the square could be described by a set of overlapping waves. Looking at the pan-magic square it can be seen that in one direction numbers alternate between the ranges 1-8 and 9-16. This can be described as a simple sine wave in that direction. In the other direction there are two possibilities depending on the square. The numbers could alternate as two pairs or as a 1-2-1 set. Again, both can be described as simple sine waves. By assigning a 1 to the high points of the waves and a 0 to the low points a base square of zero's and one's is described. Subtracting eight from all the values from 9 to 16 yields a new cube with highs in the range 5-8 and lows in the range 1-4. This gives the second base square of zero's and one's based on the new highs and lows. The third base square is found by subtracting 4 from the values from 5 to 8 in the intermediate square and the fourth base square after subtracting 2 from the values 3 and 4. The waves described become the A0, B0, and B1 base lines discussed in Magic Squares.

Shortly thereafter, I started thinking about how to apply the square concept to a cube. When I first envisaged making a 3-D counterpart of the pan-magic squares, I wanted a cube that had all the properties of the square, upgraded to three dimensions. At that time, I was looking at just row, column, diagonals, and 2X2 squares of all possible translations for the upgrade. The 3-D counterpart of the 2X2 square is a 2X2X2 cube. This small cube requires eight numbers. Therefore, the magic cube needed to be an 8X8X8 cube so that all rows, columns, pillars, diagonals, and the 2X2X2 cubes would contain 8 numbers. The base lines, therefore, needed to contain 8 bits.

There are 35 possible base lines that start with a zero and contain 4 zero's and 4 one's. To me, the obvious base lines were 01010101, 00110011, 01100110, 00001111 and 00111100. All of these can be generated using a sine curve and thus met my sense of the necessary symmetry. Many base cubes can be made from these base lines, however, I was not successful at making a cube with just these 5 base lines. It is possible, but at the time my ability to test different configurations was limited by the amount of time it took to test them using just paper and pencil. My breakthrough came when I also recognized 01011010 as a possible base line. The base line did not fit a sine curve but it was symmetric about the center and both halves fit a sine curve.

When I finally constructed a cube containing all 512 numbers I then had to check for the magic sum in all proposed additions. By then calculators had become cheap enough that a poorly paid graduate student could afford one. I remember using my new Texas Instruments SR-10 to check all of the sums, a rather tedious but (I thought) necessary process. (See Magic Cubes for current approach.) This was the summer of either 1971 or 1972. I showed the completed cube to a few people but was unsure how to reach a wider audience. My roommate's girlfriend recalled that her high school math teacher had said that there were no known magic cubes. I was able to find a couple references to magic cubes in the literature, but nothing as elaborate as mine. My search was not very successful given the actual number of cubes known at the time. I am a chemist, and had never searched the math literature before. The magic cube was finally submitted to the Old Farmers Almanac in August of 1977. It was included in the puzzle section of the 1979 issue.6 The magic cube itself was not included in that issue as it was one of four puzzles for which a prize was offered. The puzzle solutions, including the cube, are still available through The Old Farmers Almanac.

## THE MAKING OF THE TESSERACT

One of the people I initially showed my magic cube was my brother, Leonard. He was still in high school at the time but his immediate reaction was that he would build a four dimensional counterpart based on the concept. The extension was obvious but given the tools he had available at the time not very practical. Pencil and paper were not going to readily generate a tesseract of 65536 numbers. I discouraged his enthusiasm, perhaps prematurely considering his early entry in the computer field.

I gave very little thought to the cube or the tesseract until the mid 90's when I realized that technology would finally allow me to build a magic tesseract. With a computer and an Excel spread sheet, construction was possible.

I first spent some time working with the cube. With the computer, I was able to determine that there were only eight C base lines and 96 base cubes. It was apparent also that there were many possible magic cubes and it was relatively easy to generate other examples. I produced an Excel sheet that could generate these cubes but it was not very user friendly. There was also a magic constant checker to confirm all possible additions. I have upgraded this sheet to include more magic constant sums and other enhancements if anyone is interested. It also contains some literature cubes with a method to break them down to base cubes. It is on the Downloads page as CubeCheck.

For the tesseract, the most time consuming part was generation of a tesseract magic constant checker. The checker was built first as I still believed it necessary to check all possible sums for validity. The checker only evaluated rows, columns, pillars, files, diagonals (2-D, 3-D, and 4-D), and 2X2X2X2 tesseracts. This required so many calculations that it had to be broken into three separate Excel sheets to keep from overloading my Macintosh Performa 600.

Once the magic constant checker was made, all the 16-bit base lines that have equal numbers of zero's and one's were tested to determine the D base lines. The nature of the base lines was still not well understood although they could be determined by testing potential base tesseracts. A surprising result to me at the time was that some base lines did not fit my sense of symmetry.

A tesseract was relatively easy to make with the magic constant checker and the appropriate base lines. It was just a matter of trial and error as each successive base tesseract was added. Each intermediate was tested for both uniform integral distribution and magic tesseract addition properties. I did nothing with this completed tesseract other than show it to my brother, Leonard, in order to let him know he was right. The tesseract was an obvious extension. I did not even think of a five dimensional figure at the time. That was just crazy, no spreadsheet could hold it.

## THE MAKING OF THE GENERATORS

A couple years ago, when I found myself with more time than sense, I decided to attempt to determine how many magic cubes were in the set described by my base lines. I spent some time with my Excel sheets trying to find a way to enumerate and then just estimate what became a very large number of potential magic cubes. When my middle son, Keith, came home after his freshman year of college, he introduced me to a much better approach, Xcode. In the ensuing collaboration, we have formalized many of the characteristics of the cube.

Keith devised a simple cube generator and checker that have since undergone numerous changes. We then attacked the problem of enumerating the magic cubes from different angles. My approach was to develop rules to determine which sets of base cubes were incompatible. Those combinations of base cubes could then be avoided. There were some combinations of two base cubes which were incompatible the simplest of which is that a base cube cannot be used twice in the same magic square. Rules became more numerous and more complicated as they involved interactions of more base cubes. I finally gave up the approach when confronted with finding rules for combinations of eight base cubes, a rather daunting task. (See Base Cube Rules for further discussion.)

Keith's approach was more along the line of brute force. Using various optimizations, he was able to evaluate all 969 possible combinations of nine base cubes. Doing this he found 6,436,518,100,992,000 which were nasik magic cubes. All had their zero at the same position in the cube. I suspect that in this little exercise, Keith generated more magic cubes than all that were known previously. This even though 47 out of 48 are just different aspects of other cubes he created. Eliminating the redundant aspects there are still 134,094,127,104,000 different nasik magic cubes of order-8. Multiplying the 6 quadrillion magic cubes he found by the 512 possible translations yields the 3 quintillion visually different magic cubes mentioned on the introductory page and in the title of a talk given at ISMAA 2007.

Somehow, during the race to count the cubes I was talked into making the cube generator. Keith was again away at school but my youngest son, Neil, offered his help. That should have been warning enough. He probably convinced me to do it by making it look so easy. It was not easy for me. I struggled with concepts, I struggled with Xcode, I struggled with Neil, however, a cube generator gradually took shape.

I did not have a good picture of what I wanted in a cube generator and kept adding various features in a haphazard manner. Every once in a while one of my sons would look at what I had done, pronounce it garbage and rewrite in an hour what took me days. Unfortunately, I usually could not decipher what they had written so that when I needed to modify it further I was in trouble. Little by little, my understanding if not my technique improved. The resulting code is an amalgam of well-written pieces of code held together with my bubblegum. Some major parts such as the base line editor and magic constant checker were added as afterthoughts and crammed into the middle of an already confusing program. It was written on an iMac G5 using Xcode and only superficially tested on Windows. It was designed for a resolution of 1024 X 640.

The tesseract generator was built more quickly than the cube generator and really is better organized. Because of the complexity of going from the manipulation of 512 numbers and 96 base cubes to 65536 numbers and 49152 base tesseracts, processing time became an issue. But again, that problem was solved for me. Visualization of the tesseract is also a problem as there is not room on a computer screen to show all 65536 numbers, although they are shown as little dots in the magic constant checker. Even though there are programs that show rotating tesseracts, one filled with 65536 numbers would be indecipherable. At most only one of 256 16x16 two-dimensional planes can reasonably be shown at any one time.

The generality of the approach as well as the difficulty in displaying a meaningful illustration come together with the 5-D hypercube generator. Merely confirming the correctness of a 5-D hypercube approaches the limits of my current computer even though it takes less than a second to do so. Despite this limitation, it is possible to definitively describe nasik magic hypercubes of any dimension.

## THE UPSIZED FIGURES

One day while waiting for some work to be done on my car I started wondering if my method could be used to make magic squares with Franklin diagonals. I had just read about them on a couple web sites and was intrigued. Prior to that I had focused my attention only on n-dimensional figures of order-2n. With paper and pencil I started creating order-8 base squares that fit the requirements for Franklin diagonals. It was easy to see which base line combinations resulted in Franklin diagonals. During a 45 minute wait I was able to combine base squares to create three order-8 pan-magic squares with Franklin diagonals including one that was also most-perfect.

It was easy to see the utility of my approach for making magic figures of order-2n+i By properly choosing base line combinations, many features could be easily incorporated into the resulting magic squares. Over the course of the next two weeks, I created most of the magic figures that now appear in the SquareLines and CubeLines spreadsheets available on the Downloads page. The tesseracts and figures made with ternary, quinary, etc. base lines were made later.

Neil first suggested that I look at figures made using ternary base lines. I was reluctant at first as I was already trying to tie up too many loose ends but he persisted and provided a set of order-9 base lines and base squares to work from. Rules to create the base lines were formulated and pan-magic squares constructed. Extension to other bases was obvious creating a new line for further development. Neil also discovered the pan-anti-magic squares that appear as the last subsection on this site.