 English Japanese Home Site Map Top Prev. Next   3-D ( 1   2   3   4   5 )   4-D ( 1   2   3   4   5   6 )

# Algorithms to make pan-3,4-agonal magic tesseracts

[Order 4x] [Order 2x+1]

## 1. Algorithms for orders divisible by 4

A pan-3,4-agonal magic tesseract of even order can exist only if the order is divisible by 4. If the order is 8 or higher, an associated pan-3,4-agonal magic tesseract can exist. Moreover, a 2D-compact pan-3,4-agonal magic tesseract can exist for any order divisible by 4. (Every 2D-compact magic tesseract is pan-3,4-agonal and cannot be diagonal).

### 1.1 Non-associated pan-3,4-agonal magic tesseracts (m = 4x) (also complete and 2D-compact)

A pan-3,4-agonal magic tesseract aijkh of order m, where i,j,k,h = 0,...,m-1, is given by the following equation (aijkh is also complete and 2D-compact):
aijkh = Tm(bijkh) m3 + Tm(cijkh) m2 + Tm(dijkh) m + Tm(eijkh) + 1,

where
bijkh = i + (m/2)j + (m/2)k + (m/2)h   (mod. m),   0 <= bijkh < m,
cijkh = (m/2)i + j + (m/2)k + (m/2)h   (mod. m),   0 <= cijkh < m,
dijkh = (m/2)i + (m/2)j + k + (m/2)h   (mod. m),   0 <= dijkh < m,
eijkh = (m/2)i + (m/2)j + (m/2)k + h   (mod. m),   0 <= eijkh < m,
Tm(x) = x (if x < m/2),   3m/2-1-x (otherwise).

This definition of Tm(x) is identical to the definition of Tm(x) for pantriagonal magic cubes.

This tesseract is expressed as follows by the XmlHypercube format by Aale de Winkel:
for m = 4:
LP({1,2,2,2},{2,1,2,2},{2,2,1,2},{2,2,2,1})= [0,1,3,2]
In general:
LP({1,m/2,m/2,m/2},{m/2,1,m/2,m/2},{m/2,m/2,1,m/2},{m/2,m/2,m/2,1})= [0,..,m/2-1,m-1,...,m/2]

Note
It can be proved that every order-4 pan-3,4-agonal magic tesseract is complete and 2D-compact. On the other hand, if the order is 8 or higher and divisible by 4, a magic tesseract exists which is pan-3,4-agonal but not 2D-compact. If the order m is prime to 7, such a tesseract is given by the following XmlHypercube format. The tesseract generated by this expression is not 4D-compact, either.

for m >= 8 and primt to 7 (pan-3,4-agonal, complete, but not 4D-compact):
LP({1,2,2,2},{2,1,2,2},{2,2,1,2},{2,2,2,1})= [0,..,m/2-1,m-1,...,m/2]

As mentioned above, this expression gives an 2D-compact magic tesseract for m = 4. There exists a similar expression by XmlHypercube format for m not prime to 7. Back

1.2 Associated panmagic tesseracts (m = 4x, x >= 8) (also 2D-compact)

An associated pan-3,4-agonal magic tesseract aijkh of order m, where i,j,k,h = 0,...,m-1, is given by the following equation (aijkh is also 2D-compact):
aijkh = bijkh m3 + cijkh m2 + dijkh m + eijkh + 1,

where
bijkh = Hm(i)   (if j+k+h is even),    m - 1 - Hm(i)   (otherwise),
cijkh = Hm(j)   (if i+k+h is even),    m - 1 - Hm(j)   (otherwise),
dijkh = Hm(k)   (if i+j+h is even),    m - 1 - Hm(k)   (otherwise),
eijkh = Hm(h)   (if i+j+k is even),    m - 1 - Hm(h)   (otherwise),
Hm(x) = H'm(x)   (if x < m/2),    H'm(m-1-x)   (otherwise).

The function H'm(x), where 0 <= x < m/2, is defined as follows:

when m is divisible by 8:
H'm(x) = x (if x = 0 or 3 (mod. 4)),
m - 1 - x (otherwise),

when m is divisible by 4 but not by 8:
H'm(x) = x (if x < m/2-5 and x = 0 or 3 (mod. 4), or x = m/2-4),
m - 1 - x (otherwise). Back

## 2. Algorithms for odd orders

A pan-3,4-agonal magic tesseract of odd order m can exist only if the order is higher than 7, and an associated pan-3,4-agonal magic tesseract of odd order can exist under the same condition.
The function gcd means the greatest common divisor.

### 2.1 Case m = 2x+1, m >= 9, and gcd(m, 3x5x7) = 1 (associated)

In this case, m is prime to 3, 5, and 7.
A pan-3,4-agonal magic tesseract aijkh of order m, where i,j,k,h = 0,...,m-1, is given by the following equation:
aijkh = bijkh m3 + cijkh m2 + dijkh m + eijkh + 1,

where
bijkh = 4i + j + k + h + 3   (mod. m),   0 <= bijkh < m,
cijkh = 4i - j + k + h + 2   (mod. m),   0 <= cijkh < m,
dijkh = 4i + j - k + h + 2   (mod. m),   0 <= dijkh < m,
eijkh = 4i + j + k - h + 2   (mod. m),   0 <= eijkh < m.

This tesseract is expressed as follows by the XmlHypercube format by Aale de Winkel:
LP({4,1,1,1}+3,{4,-1,1,1}+2,{4,1,-1,1}+2,{4,1,1,-1}+2)

### 2.2 Case m = 2x+1, m >= 9, and 1 < gcd(m, 3x5x7) < m (associated)

Let q be gcd(m, 3x5x7) and p be m/q. In this case, p > 1 and q > 1.
A pan-3,4-agonal magic tesseract aijkh of order m, where i,j,k,h = 0,...,m-1, is given by the following equation:
aijkh = Sm,q(bijkh) m3 + Sm,q(cijkh) m2 + Sm,q(dijkh) m + Sm,q(eijkh) + 1,

where
bijkh = 4i + j + k + h + 3   (mod. m),   0 <= bijkh < m,
cijkh = 4i - j + k + h + 2   (mod. m),   0 <= cijkh < m,
dijkh = 4i + j - k + h + 2   (mod. m),   0 <= dijkh < m,
eijkh = 4i + j + k - h + 2   (mod. m),   0 <= eijkh < m,
Sm,q(x) = Qp,q([x/q], x mod q),

where [x] means the integer part of x.

Qp,q(x, y), where 0 <= x < p and 0 <= y < q, is given by the following equations (identical to Qp,q(x, y) for Nasik magic cubes):
Qp,q(x, y) = qx + y (if 0 < x < p-1 and x is even),
qx + (q-1-y) (if 0 < x < p-1 and x is odd),
y/2 + (q-1)/2 (if x = 0 and y is even),
(y-1)/2 (if x = 0 and y is odd),
y/2 + (p-1)q (if x = p-1 and y is even),
(y-1)/2 + pq - (q-1)/2 (if x = p-1 and y is odd).

See the page for Nasik magic cubes to see examples of Qp,q(x, y) and Sm,q(x).

### 2.3 Case m = 2x+1, m >= 9, and gcd(m, 3x5x7) = m (associated)

In this case, m is equal to 15(=3x5), 21(=3x7), 35(=5x7), or 105(=3x5x7).
A pan-3,4-agonal magic tesseract aijkh of order m, where i,j,k,h = 0,...,m-1, is given by the following equation:
aijkh = S*m(bijkh) m3 + S*m(cijkh) m2 + S*m(dijkh) m + S*m(eijkh) + 1,

where
bijkh = 4i + j + k + h + 3   (mod. m),   0 <= bijkh < m,
cijkh = 4i - j + k + h + 2   (mod. m),   0 <= cijkh < m,
dijkh = 4i + j - k + h + 2   (mod. m),   0 <= dijkh < m,
eijkh = 4i + j + k - h + 2   (mod. m),   0 <= eijkh < m,
S*15(x) = R3,5(x mod 3, x mod 5) - 1,
S*21(x) = R3,7(x mod 3, x mod 7) - 1,
S*35(x) = R5,7(x mod 5, x mod 7) - 1,
S*105(x) = R3,5,7(x mod 3, x mod 5, x mod 7) - 1.

R3,5, R3,7, R5,7, and R3,5,7 are associated magic rectangles of orders (3,5), (3,7), (5,7), and (3,5,7), respectively. For more information, see the page for Nasik magic cubes. Back Home Site Map Top Prev. Next   3-D ( 1   2   3   4   5 )   4-D ( 1   2   3   4   5   6 )

Mitsutoshi Nakamura (Feedback)    To send an email to me, please enable JavaScript on your browser.
[Legal indication] Prohibit the send of any spam or advertising. Magic Cubes and Tesseracts 