# Hypercube Math

Introduction

This page is a collection of mathematical expressions and tables that are involved with magic squares and cubes.  Emphasis will be put on relationships between magic hypercubes of different dimensions.The terms magic square, magic cube, magic tesseract, etc. will be used for specific dimensions.
The term magic hypercube will be used to indicate a magic rectilinear object in any dimension.

Much of this material is taken from John R. Hendricks books which, unfortunately, are now out of print.
A small interactive spreadsheet program that shows statistics based on 3 input variables is available for download here
The Magic Square Lexicon is still available here.
Mitsutoshi Nakamura seems to be the only person doing extensive work with magic tesseracts at this time. He contributed much of the information on tesseract classes. His website is here.

It is appropriate to mention here, the different types of mathematics that may be involved in the investigation of magic hypercubes.

• ·        Arithmetic

• ·        Algebra

• ·        Geometry (in regard to coordinates, used in modular equations and paths).

• ·        Modular arithmetic, congruences

• ·        Different number systems (where radix = m)

• ·        Matrix arithmetic

• m  =  order

• n  =  dimension

• r  =  represents all agonals from 1-agonal to n-agonals. i.e all lines in the hypercube.

• S  =  magic constant

• Nasik will be used to denote hypercubes where all lines through each cell sum correctly. This is an unambiguous term that
avoids the confusion between Hendricks perfect and Boyer’s perfect. C. Planck set the precedent for this in his 1905 paper.

C. Planck, The Theory of Path Nasiks, Printed for private circulation by A. J. Lawrence, Printer, Rugby (England),1905
(Available from The University Library, Cambridge).
See a quotation here.
W. S. Andrews, Magic Squares and Cubes. Open Court Publ.,1917. Pages 365,366, by Dr. C. Planck.
Re-published by Dover Publ., 1960 (no ISBN); Dover Publ., 2000, 0486206580; Cosimo Classics, Inc., 2004, 1596050373

### Hypercube equations

• Magic constant or Sum of a hypercube                        ….  S = {m(mn + 1)} / 2

• Minimum sums required to be Simple magic              .....  Ss = 2n-1 + nmn-1

• Minimum sums required to be Nasik magic                ....   Sn = {(3n – 1)mn-1} / 2

• Smallest order for a Nasik hypercube                          ....   2n  ....   2n + 1 if associated

• Paths (lines) through any cell of a hypercube               ….   P = (3n – 1) / 2

• Number of aspects (views) of a hypercube                  ….   A = 2n n!

• 1-agonals (orthogonal lines, i-rows) in a hypercube    ….  O = n(mn-1)

• There are 2n corners and 2n-1  n-agonals in a magic hypercube

• Squares in a n-dimensional hypercube of order m     ….    N = {n(n – 1) / 2} mn-2
Of the above,   ….  n(n-1)2n-3  are boundary squares.

• Edges in a n-dimensional magic hypercube                ….   E = n(2n-1)

### Hypercube tables

Hypercubes –Minimum number of correct summations

This table provides the minimum requirements for each category. Usually, there are some extra lines which may sum the magic sum, but not a complete set so as to change the category.
In this table I have replaced the term perfect (Hendricks) with Nasik.

This table is taken from The Magic Cube Lexicon, but edited with added tesseract material supplied by Mitsutoshi Nakamura Sept. 20, 2007.

First person shown to construct each minimum order cube and tesseract is to the best of my knowledge. If you have different information, please let me know. Minimum order for some of the tesseract classes shown has not yet been established. In that case I show the first constructer for the class.
John Hendricks was the first to publish all 58 order-3 magic tesseracts in (Magic Square Course, 2nd edition, 1992).

NOTE: I cannot testify as to the correctness of these tesseracts, as I have not had a chance to check out their features.

H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000, 0-9687985-0-0, page 165 (edited)
Mitsutoshi Nakamura’s tesseracts at http://homepage2.nifty.com/googol/magcube/en/

 Hypercubes –Minimum number of correct summations  - based on smallest order possible Magic Hypercube Lowest Order (m) r-agonals Min. Sums This order first Built by 1 2 3 4 Total Square Simple 3 2m 2 ---- ---- 2m + 2 8 ? Nasik  (Pandiagonal and Perfect) 4 2m 2m ---- ---- 4m 16 ? Cube Simple 3 3m2 ---- 4 ---- 3m2 + 4 31 Hugel  - 1876 Diagonal   (Boyer/Trump Perfect) 5 3m2 6m 4 ---- 3m2+6m+4 109 Trump/Boyer - 2003 Pantriagonal 4 3m2 ---- 4m2 ---- 7m2 112 Frost - 1878 PantriagDiag 8? 3m2 6I 4m2 ---- 7m2+6m 496 Nakamura - 2005 Pandiagonal 7 3m2 6m2 4 ---- 9m2 + 4 445 Frost – 1866 Nasik (Hendricks Perfect) 8 3m2 6m2 4m2 ---- 13m2 832 Barnard 1888 Tesseract Simple 3 4m3 ---- ---- 8 4m3 + 8 116 Planck – 1905 Triagonal 4 4m3 ---- 16m 8 4m3 + 16m + 8 328 Nakamura - 2007 Diagonal 4 4m3 12m2 ---- 8 4m3 + 12m2 + 8 456 Nakamura – 2007 Diagonal + Triagonal 8? 4m3 12m2 16m 8 4m3 + 12m2 + 16m + 8 2,952 ? Nakamura – 2007 Panquadragonal 4 4m3 ---- ---- 8m3 12m3 768 Hendricks – 1968 Triagonal + Pan4 4 4m3 ---- 16m 8m3 12m3 + 16m 832 Nakamura – 2007 Diagonal + Pan4 8? 4m3 12m2 ---- 8m3 12m3 + 12m2 6,912 ? Nakamura – 2007 Diagonal + Triagonal+Pan4 8? 4m3 12m2 16m 8m3 12m3 + 12m2 + 16m 7,040 ? Nakamura – 2007 Pandiagonal 9? 4m3 12m3 ---- 8 16m3 + 8 11,672 ? Nakamura – 2007 Triagonal + Pan2 ? 4m3 12m3 16m 8 16m3 + 16m + 8 ? --- ? Pantriagonal 4 4m3 ---- 16m3 8 20m3 + 8 1,288 Nakamura – 2007 Diagonal + Pan3 ? 4m3 12m2 16m3 8 20m3 + 12m2 + 8 ? --- ? Pan2 +Pan4 13? 4m3 12m3 ---- 8m3 24m3 52,728 ? Nakamura – 2007 Triagonal + Pan2 + Pan4 16? 4m3 12m3 16m 8m3 24m3 + 16m 98,560 ? Nakamura – 2007 Pan3 + Pan4 4 4m3 ---- 16m3 8m3 28m3 1,792 Nakamura – 2007 Diagonal + Pan3 + Pan4 8 4m3 12m2 16m3 8m3 28m3 + 12m2 15,104 Nakamura – 2007 Pan2 + Pan3 15? 4m3 12m3 16m3 8 32m3 + 8 108,008 Nakamura – 2007 Nasik  (Hendricks perfect) 16 4m3 12m3 16m3 8m3 40m3 163,840 Hendricks - 1998

I show Hendricks as the first to publish a perfect magic tesseract. However, C. Planck showed 1 plane of a perfect order 16 octahedroid in his 1905 paper.
C. Planck, The Theory of Path Nasiks, Printed for private circulation by A. J. Lawrence, Printer, Rugby (England),1905  (Available from The University Library, Cambridge).

 Hypercubes - Correct Summations Required Magic Square Simple Magic Cube Simple Magic Tesseract Simple m rows m2 rows m3 rows m columns m2 columns m3 columns 2 diagonals m2 pillars m3 pillars 4   3-agonals m3 files 8    4-agonals Total = 2m + 2 Total = 3m2 + 4 Total = 4m3 + 8 Nasik perfect Nasik perfect Nasik perfect m rows m2 rows m3 rows m columns m2 columns m3 columns 2m diagonals m2 pillars m3 pillars 4m2   3-agonals m3 files 6m2   2-agonals 8m3    4-agonals 12m3    3-agonals 16m3    2-agonals Total = 4m Total = 13m2 Total = 40m3
 Comparing Order-3 Hypercube Dimension Facts Dimension Correct lines Number of Basic Aspects 2 8 1 8 3 31 4 48 4 116 58 384 5 421 2992 3840 6 1490 543328 46080

Keh Ying Lin, Cubes and Hypercubes of Order Three, Discrete Mathematics, 58, 1986,
pp 159-166
J. R. Hendricks, Magic Square Course, self-published 1991
J. R. Hendricks, All Third Order Magic Tesseracts, self-published 1999, 0-9684700-2-5
H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000, 0-9687985-0-0, page 93

Notes for table on left:
J. R. Hendricks, Perfect n-Dimensional Magic Hypercubes of Order 2n,  Self-published, 1999, 0-9684700-4-1.
H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000,
0-9687985-0-0, page 90

An n-agonal is a line going from 1 corner, through the center to the opposite corner, of a magic hypercube.

For each continuous n-agonal, there are a number of broken parallel lines, depending upon the order of the hypercube. There are 2 continuous diagonals in a square, 4 continuous triagonals in a cube, and 8 continuous quadragonals in a tesseract.

 Number of broken n-agonals for each continuous one Total pan-n-agonals n 2 segment 3 segments 4 segments Total 1 segment Total 2 m–1 0 0 m 2 2m 3 3(m-1) (m-1)(m-2) 0 m2 4 4m2 4 2(5m-8) 2(2m2-7m+7) (m-1)(m-2)(m-3) m3 8 8m3

H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000, 0-9687985-0-0, page 99 (edited)

One (or more) of the equations for the tesseract is incorrect (maybe a typo in the source?)!
Can anyone supply me with the correction?

Because there are four triagonals in a magic cube,  the above figures must be multiplied by four to obtain the actual number of triagonals in the cube.

H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000,
0-9687985-0-0, page 170 (edited)

 Triagonals in one direction of a cube Order 1 segments 2 segments 3 segments Total 3 1 6 2 9 4 1 9 6 16 5 1 12 12 25 6 1 15 20 36 7 1 18 30 49 8 1 21 42 64 9 1 24 56 81 10 1 27 72 100

 Number of Hyperplanes Within a Hypercube Magic Hypercube i-rows (1-agonals) Squares Cubes Tesseracts 5-D Hypercubes Squares 2m 1 0 0 0 Cubes 3m2 3m 1 0 0 Tesseracts 4m3 6m2 4m 1 0 5-D Hypercubes 5m4 10m3 10m2 5m 1 6-D Hypercubes 6m5 15m4 20m3 15m2 6m 7-D Hypercubes 7m6 21m5 35m4 35m3 21m2

Not all of these hyperplanes are magic unless the Hypercube is Nasik (Hendricks perfect).

J. R. Hendricks, Perfect n-Dimensional Magic Hypercubes of Order 2n, Self-published, 1999, 0-9684700-4-1 page 5.

 n-Dimensional Magic Hypercubes – Statistical Information Dim Hyper- cube # of Corners # of Edges Bounded by Magic Sum Paths through any cell Minimum Sums required for magic Minimum Sums required for Nasik Perfect # of Viewing Aspects 0 Point 1 0 0 1 0 1 0 1 1 Line seg. 2 1 2 points S = {m + 1)} / 2 0 1 1 2 2 Square 4 4 4 line segments S = {m(m2 + 1)} / 2 4 2m + 2 4m 8 3 Cube 8 12 6 squares S = {m(m3 + 1)} / 2 13 3m2 + 4 13m2 48 4 Tesseract 16 32 8 cubes S = {m(m4 + 1)} / 2 40 4m3 + 8 40m3 384 n Hypercube 2n n(2n-1) 2n hypercubes (of n-1) S = {m(mn + 1)} / 2 P = (3n – 1) / 2 nmn-1 + 2n-1 Sn = {(3n – 1)mn-1} / 2 2nn!

J. R. Hendricks, Magic Squares to Tesseract by Computer, Self-published, 1998, 0-9684700-0-9  page 134 (edited)

### Digital equations

This is one method of finding solutions to magic hypercubes. This was a favored method of the late John R. Hendricks.

If the digits of a number can be expressed as a function of their coordinate location, then the equation(s) describing the relationship can be called digital equations. They are sometimes referred to as congruence equations or modular equations.

For example:  To solve the order 3 magic square (the Luo-shu).
If at coordinate location (1, 3) we wish to find the number and it is known that:
D2 Ξ x + y        (mod 3)
And D1 Ξ 2x + y + 1   (mod 3

then the two digits D2 and D1 can be found.

D2 Ξ 1 + 3 Ξ 4 Ξ 1 (mod 3)
And D1 Ξ 2 + 3 + 1 Ξ 6 Ξ 0 (mod 3)

So the number 10 (mod 3) is located at (1, 3).
To convert to a decimal number in the range of 1 to m;  3 * 1 + 0 + 1 = 4

J. R. Hendricks, Magic Squares to Tesseract by Computer, Self-published, 1998, 0-9684700-0-9  pp. 10-13
H. D.  Heinz & J. R. Hendricks, Magic Square Lexicon: Illustrated, , HDH, 2000, 0-9687985-0-0, page 35

Comparative rarity

A quick study reveals the futility of attempting to construct a magic hypercube by simply arranging the numbers randomly. That is, without using mathematical methods.

To illustrate this point, consider the easiest of all magic hypercubes to construct, the order 3 magic square.
The array uses just nine integers, which can be arranged in 9 factorial ways. 9 factorial (written 9!) = 1x2x3x4x5x6x7x8x9 = 362,880. There is 1 basic order 3 magic square, but it may be shown in 8 aspects (due to rotations and /or reflections). So the chance of stumbling on one of these 8 variations is 8/9! Or 1 chance in 45,360.

The next smallest hypercube is the order 4 magic square. There are 880 basic squares of this order, times the 8 variations gives a total of 7040 squares. They use the integers from 1 to 16 so the relative rarity is 7040/16!, or 1 chance in 2,971,987,200.

By the time we get to an order 8 magic square, we will find the number of possible combinations to try is 64 factorial. This is greater then the number of atoms in the universe!

Consider then, the rarity of an order 3 tesseract, which uses the numbers from 1 to 81. Or an order 8 tesseract where the number of possibilities is factorial 4096.