WELCOME TO MAGIC CUBE GENERATOR

BY: Dwane H. Campbell and Keith A. Campbell

This site will focus primarily on a set of 8 by 8 by 8 magic cubes that are often called perfect magic cubes of order 8, Nasik magic cubes of order 8, or order-8 pan-2,3-agonal magic cubes. There are 3,295,497,267,707,904,000 (3.3 quintillion) visually different magic cubes described in this set. All cubes in the set have over 10,000 different ways to sum to the magic constant.

There are cubes of other orders that are considered perfect by various definitions. They will not be discussed here as they are not readily manipulated using the binary math that is the basis for the cubes on this site..

A method to generate the order 8 cubes is described. A downloadable program, the cube generator, can quickly generate any of the perfect magic cubes. Once created any cube can be manipulated further by rotations, inversions, translations, and other changes to make additional perfect magic cubes with the same properties. Creation and manipulation of the cube is done in a way to demonstrate the simple underlying principles.

A secondary focus of this site is a set of 16 by 16 by 16 by 16 perfect magic tesseracts or order-16 pan-2,3,4-agonal magic tesseracts. There are ~1.8E63 unique tesseracts in this set with over ten million ways to sum to the magic constant. These can be made and manipulated using the tesseract generator. There is also a 5-D hypercube generator that can make perfect order 32 5-D hypercubes or order-32 pan-2,3,4,5-agonal magic 5-D hypercubes. Finally a method for making n-dimensional perfect hypercubes is described.

The perfect magic figures described herein are just manifestations of the larger set of n dimensional perfect magic figures with sides of length 2 to the nth power. The basic properties of these figures can be described by an examination of the set of 4 by 4 panmagic squares, the smallest recognized member of the set of n dimensional perfect magic figures. The principles of the square creation can then be extended to make magic cubes, magic tesseracts and higher dimensional figures with similar magic properties.

The concepts behind the cubes are actually quite simple. An attempt will be made to describe the construction and characteristics of the cubes in terms that are understandable to anyone with minimal mathematical background. It is suggested that one read through the Basic Concepts and Magic Cube basics before attempting to use one of the generators as they give background on how and why they work. The guides for each generator should also be perused as use of some functions is not intuitively obvious.

There are numerous sites that provide background information about magic squares, cubes, tesseracts, etc. Although this site will use some of the definitions and conventions from these other sites, some concepts will be described differently. An attempt will be made to provide explanations for any terms used. Better descriptions will often be provided at the other sites. Some definitions of terms as I use them on these pages are shown at the bottom of this page.

SPECIAL PROPERTIES OF THE PERFECT MAGIC CUBES

Order-4 panmagic squares

115612
810313
115162
14497

A magic cube is the three dimensional counterpart of magic squares which have been known for millennia. Normally a magic square is a set of consecutive numbers arranged in a square pattern such that every row, column and diagonal adds to the same number, its magic constant. Panmagic squares, a 4 by 4 example of which is shown, have additional properties. For panmagic squares, in addition to the rows, columns, and diagonals, all broken diagonals also add to the magic constant (34 for this square). The four number sets 8, 15, 9, 2 and 15, 3, 2, 14 are two examples of broken diagonals in the square above. An alternate way of describing this property is to wrap around a row or column to the opposite side of the square creating a new square. The diagonals of the new square will have been broken diagonals in the old and vice versa. If the left column in the square above is moved to the right side the new square will have 15, 3, 2, and 14 as an unbroken diagonal and all rows, columns, and diagonals will still add to the magic constant.

The order 4 panmagic squares have additional combinations that add to 34. These combinations are seldom mentioned in general discussions of panmagic squares, as they are not requirements for the class. Some are only applicable to the 4 by 4 squares. All the 2 by 2 squares within the larger square, the corners of the magic square, and the corners of each 3 by 3 square add to the magic constant. The magic constant is also obtained by adding two consecutive numbers in one column or row to the two numbers that are the continuation of that column or row shifted by two. Two examples are 1, 8, 16, 9 and 14, 10, 3, 7. There are a total of 52 easily described ways that these magic squares add to 34. The other 34 possible number combinations that add to 34, do not form easily described configurations in the square.

Order-8 pan-2,3-agonal magic cubes

The magic cube counterpart of the 4 by 4 panmagic squares is an 8 by 8 by 8 matrix of 512 consecutive numbers. For the numbers 1 to 512 each row, column, and pillar must add to 2052. Also the diagonals and broken diagonals of every 8 by 8 square and the four 3-D diagonals and all broken diagonals of the cube must add to the magic constant. The above properties are the requirements for the subset of magic cubes that are often called perfect magic cubes, but are more precisely called order-8 pan-2,3-agonal magic cubes. In this name pan indicates the property of moving a face from one side of the cube to the other whereas for a square it was a column or row. The 2,3-agonal indicates the 2 and 3-dimensional diagonals of the cube. Order-8 means it is an 8 by 8 by 8 cube.

As a bonus, the cubes described here have every 2 by 2 by 2 cube, the corners of the cube, and the corners of every 3 by 3 by 3, 4 by 4 by 4, 5 by 5 by 5, 6 by 6 by 6, and 7 by 7 by 7 cube add to 2052. Also the corners of many rectangular prisms, shifted rows, shifted columns, shifted pillars, shifted diagonals, and other patterns add to the magic constant. There are many easily described patterns within the cube that always add to 2052. Finally the addition properties for these cubes are maintained when faces of the cube are wrapped around to the opposite side in any order.

LITURATURE CUBES

The first cube of this type has been attributed to Barnard1. It has often been attributed to Frankenstein, but his cube does not include broken diagonals and thus is not perfect by the current definition. Another example was described by Plank2 in 1905. The next published example of this type of cube, submitted by Dwane H. Campbell, was described in the puzzle section of the 1979 issue of The Old Farmers Almanac. The solution to the puzzle was not given in that issue but is available through Yankee, Inc. This latter cube may be the first example of the set described here. Barnard's and Plank's cubes cannot be constructed using the procedure outlined in this discussion although some of their characteristics are similar. The first two cubes and their history can be found on Heinz's site.

There have been other perfect order 8 magic cubes published subsequent to 1979. Benson and Jacoby5 published a cube in 1982 that is the same as Plank's except that the numbers were translated using the wrap around property of the cube so that the 1 appears in the lower left corner of the front square of the cube. By most definitions this would not be considered a different cube. It is only visually different. Hendricks'3 cube appears to have been constructed by a process that is similar to Barnard's cube and thus distinct from the set described herein. Nakamura also has an algorithm to generate a cube of this type on his site. Abe's4 cube is part of the set described here. The publication date given on Nakamura's site is 1983, but Abe's notes suggest it was first constructed in 1949. Can anyone confirm this date? See the references for further reading.

Hendricks3 also describes the first published tesseract and perfect 5-D hypercube. These also are made differently than those described here. It is not possible to make them using the downloadable tesseract and hypercube generators.

DEFINITION OF TERMS AS USED ON THESE PAGES

Aspects refer visually different arrangements of the numbers in a magic figure accomplished by rotations or inversions. For an n-dimensional figure there are n! possible rotations and 2n possible inversion combinations.

Base line is a series of bits of length 2n where n is the number of dimensions in the desired final figure. The line consists of equal numbers of zeros and ones in a pattern such that either the first and second halves are identical or they are inverses. The lines are usually defined to start with a zero. They are usually shown using an alphanumeric code such as c3 where the letter indicates the length of a subunit of the code, a is 2, b is 4, c is 8, etc. The subscript becomes the binary code in the first half of the subunit and its inverse is the second half. The subunit is repeated until the base line is filled.

Base line family is one of two groupings of the cubes c base lines. The members of a family are all compatible with each other but not with members of the other family. The families are c0, c3, c5, c6 and c1, c2, c4, c7. The families are often important in determining compatibility of base cubes.

Base line type is another grouping of the cubes c base lines. The c0 base line and all seven of its translations comprise one type and the c2 base line and all of its translations comprise the other. The base line types are useful for describing non base line magic cubes.

Base square, base cube, base tesseract, etc. refers to an order-2n square, cube, etc. consisting of equal number of just zeros and ones. To be a valid base square, etc. it must add to a magic constant, 2 in all ways that the target magic figure is expected to add to its magic constant. When the term is used on these pages it always refers to a valid base figure.

Compatible base lines are base lines that can be combined in one dimension such the result after adding 2 times one base line plus the second base line is a new base line with uniform integral distribution. The base line multiplied by 2 may already be a combination of base lines.

Compatible base squares, cubes, tesseracts, etc. are base figures that can be combined such that the result after adding 2 times one base figure plus the second base figure is a new base figure with uniform integral distribution. The base figure multiplied by 2 may already be a combination of base figures.

Magic constant is the value that every row, column, etc. of the magic figure should add to.

Magic cube or magic tesseract will mean the order-8 pan-2,3-agonal magic cube or order-16 pan-2,3,4-agonal magic tesseract and not the myriad of other possible magic cubes or tesseracts.

Magic square or panmagic square when used without prefix normally infers the order-4 panmagic square as other squares are not often mentioned.

Master base lines are the numbers in the lines of the magic figure that contain the zero and are parallel to one of the axes. Combining the binary equivalents of sets of master base line numbers using an exclusive OR function will give the number in binary that occurs at the intersection of the set of master base line numbers that were combined.

Order when referring to a magic figure is usually written followed by a number such as order-4. The number indicates how many integers are in each line parallel to an axis of the figure.

Translation in a magic figure means that all number within the figure are moved to new locations within the figure using the same vector. Magic features are lost for most magic figures when the numbers are translated. The figures discussed here can all be translated without losing features.

Uneven integral distribution indicates that the count of each individual integer in a magic figure is not the same for every integer in the figure. For a magic figure there should one of every integer from 0 to 2n2. If an integer occurs twice or not at all then there is uneven distribution. For base figures there must be equal numbers of zeros and ones. For intermediate figures created during a build mode there will be a multiple of two of each integer present.

Unique cube, tesseract, etc. is a way to describe a group of cubes that share the same set of base cubes. Each cube is composed of nine base cubes. The nine multipliers of the base cubes can be placed in any order creating 9! different cubes each of these distinct cubes also have 48 aspects. All can be grouped using one unique code.

Wrap around is the ability to move one side (line for square, face for cube, etc.) of a figure to the directly opposite side without losing any of the magic features. It has the same effect as a translation.