1. Introduction
A square matrix of order
n, composed of continuous natural numbers from 1 to
, is called the magic square of order
n if the sums of elements in each row, column and diagonal are the same. This sum is called magic sum, and it is equal to
[
1]. Magic square is one of the important research objects of combinatorial design. It is applied in the fields of image processing, computer science, and cryptography [
2,
3,
4]. The study of magic squares can be traced back to ancient China. The “Luoshu” discovered 4000 years ago is a magic square of order three [
5]. Thereafter, there has been a lot of research on magic squares, and magic squares in these studies have different characteristics [
6,
7,
8]. If the sums of the numbers on each pandiagonal are the same in a magic square, this magic square is called pandiagonal magic square. The so-called pandiagonal refers to the “broken diagonal” paralleled to the diagonal, and wrap round at the edges of the square [
9,
10]. For example, let a magic square be
, then
,
, ⋯,
,
are elements of a pandiagonal. There are also other pandiagonals. After extending a magic square to the three-dimensional, a magic cube is obtained. An integer magic cube of order
n is a three-dimensional array
which consists of the numbers
, with each section and six diagonal planes being magic squares. Previous studies have given the construction methods of concrete magic cubes with various characteristics [
11,
12,
13]. If every cross section, every diagonal and every pandiagonal of the magic cube is a pandiagonal magic square, it is called a pandiagonal magic cube. The relevant concepts are strictly defined below.
An integer cube of order n is a three-dimensional array which consists of the numbers 1, 2, ⋯, . Matrices , , are called cross sections. In particular, , , are called surfaces. Similarly, matrices , , , , , are called diagonal planes.
Definition 1. An integer cube is called a pandiagonal magic cube, if all of its cross sections and diagonal planes are pandiagonal magic squares.
The concept of pandiagonal magic square can be found in [
6,
7,
8,
14]. Because a line parallel to an edge of an integer cube is a row or a column of a cross section, a great diagonal is a diagonal of a diagonal plane, so that a pandiagonal magic cube is certainly a magic cube [
15].
The studies of magic squares and magic cubes have made relatively rich achievements. Cammann and Andrews introduced the early research results of magic squares and magic cubes [
12,
16]. Abe put forward 23 questions about magic squares, involving basic magic squares, pandiagonal magic squares, sparse magic squares, anti-magic squares, etc., which promoted the study of magic squares [
17]. Loly et al. [
18], Lee et al. [
19], Nordgren et al. [
20], and Hou et al. [
21] discussed the algebraic properties of magic squares. Trenkler proposed an algorithm for making magic cubes [
22]. However, the study on pandiagonal magic cubes is rare.
In this paper, we will study the existence and construction of pandiagonal magic cubes of order
n based on the pandiagonal magic square idea in [
6]. The following is the outline of this paper. First, a three-dimensional auxiliary cube is defined and its properties are discussed. Then, based on the discussion of Latin cube and pandiagonal Latin cube, the design method of the pandiagonal Latin cube is given. At the same time, we give the necessary and sufficient conditions for the orthogonality of three pandiagonal Latin cubes. Finally, by using the orthogonal pandiagonal Latin cubes, the construction method of pandiagonal magic cubes is obtained. In addition, we give a method to find another two pandiagonal Latin cubes orthogonal to one known pandiagonal Latin cube.
3. Special Case: A Pandiagonal Magic Cube of Order 11
In this section, an example of a pandiagonal magic cube of order 11 is revealed.
First, we construct a pandiagonal Latin cube of order 11. Let
Figure 1 represent the integer cube. Let the first row of top surface, namely
be
From [
6], in order that
is a pandiagonal Latin square, it suffices to select some
k,
, such that
(because
is a prime number). Let
k = 7, i.e., let the back surface
be
:
Then take
s,
,
, for example,
. Apply
to each row of
to obtain 11 horizontal cross sections. They form the integer cube
-
, the top surface of which is
:
The second cross section under the top surface is
:
etc. We denote the cube
-
as
, since the above cube is constructed by
and
.
Now, we turn to prove that the cube
is a pandiagonal Latin cube of order 11. First, it should be noted that cross sections parallel to the top surface are all pandiagonal Latin squares. The back surface
is also a pandiagonal Latin square. It follows from symmetry of the top and back surfaces that cross sections parallel to back surface
are also pandiagonal Latin squares. We have to prove that cross sections parallel to
and the six diagonal planes are pandiagonal magic squares. The surface
is given by
This is just right
. Similarly, we can prove that all cross sections parallel to
are created through applying
to some column of top surface. Thus they are all pandiagonal Latin squares. The diagonal plane
is given by
which is
, a pandiagonal Latin square. The diagonal plane
is
We see that the above square is
, a pandiagonal Latin square. The diagonal planes
,
,
, and
are, respectively, given by
They are all pandiagonal Latin squares.
The preceding facts make clear that the cube is a pandiagonal Latin cube.
By the same method, we can construct and . It can be shown that they are all pandiagonal Latin cubes, and that , , are orthogonal.
Now we construct cube of three-tuple
, where
,
,
. For example, the top surface of
L is given by
By using this cube of 3-tuple
L, we construct the integer cube
with
Then
C is a pandiagonal magic cube which is shown in
Appendix A.
4. Main Results and Their Proofs
Our purpose is for any integer
n to derive existence conditions of pandiagonal magic cubes of order
n and to study a construction method by using the approach developed in
Section 3. First, we construct three orthogonal pandiagonal Latin cubes, and then join them into a cube of ordered three-tuples. By replacing elements of the cube into elements of some auxiliary cube, we obtain a pandiagonal magic cube.
Let be any permutation of . Without loss of generality let it just be . Otherwise, it suffices to prove the result for first, then change j into . Since this transformation changes a permutation of into another permutation of , the following discussion is valid in general.
Taking
as an edge, we construct an integer cube
-
as follows (see
Figure 1). Assume
,
. Let the back plane
be
. Apply
to each row of
to obtain
n horizontal cross sections. They form the integer cube
-
. Denote it by
or briefly
.
Now let us study sufficient conditions such that
is a pandiagonal Latin cube. By using the same method as in
Section 3, we easily follows that parallel cross sections of the cube
have identical generating transformation
for some
t. Sections parallel to pandiagonal sections of
also have identical generating transformation
for some
. Therefore it suffices to find conditions, such that
,
,
, and six diagonal sections are pandiagonal Latin squares. For pandiagonal Latin squares, we have the following theorem.
Theorem 1. Let n and k be integers with . Then is a pandiagonal Latin square of order n if, and only if,Here, means that i and j are mutually prime, namely, the maximum common factor of i and j is equal to 1. When
n is a prime number, the proof of this theorem can be found in [
6]. The proof of general situation requires the following two preliminary facts.
Lemma 2. If the first column of is a permutation of , so is every column of .
Proof. We regard an element of
as itself modulo
n, then
(
j is an integer. We choose representative elements of congruence group of modulo
n as
. Hereafter suppose just so). Consider numbers in the bracket [ ]. Since
it is clear that if 1,
, ⋯,
is a permutation of
, so are
i,
, ⋯,
(
, 2, ⋯,
n). This proves the Lemma. □
Lemma 3. If some diagonal of is a permutation of , so is each pandiagonal which is parallel to the diagonal. If some pandiagonal of is a permutation of , so is each pandiagonal which is parallel to the pandiagonal.
Proof. Since
, we can substitute
i for
for some
j. The following are the first
n rows of
From the generating rule, we see that the first
n columns just form
. Since
,
, the last
n columns also form
. Hence the line from
to
is a diagonal. The line from
to
stands for the pandiagonal
, and the line from
to
stands for the pandiagonal
. Since
is a diagonal,
are all pandiagonals which parallel to line
. Thus, if one of them is a permutation of
, then so are others. The proof for pandiagonals which are parallel to diagonal
is the same. This completes the proof of Lemma 3. □
(Proof of Theorem 1). Sufficiency. Suppose the conditions hold. From Lemmas 2 and 3, it suffices to prove that the first column and two diagonals are permutations of
. From the definition of
, its first column is
i.e., the difference of two successive elements is
. Since
, if
, the first column is a permutation of
.
Similarly, the difference of two elements of the diagonal starting from is . It follows at once from that the diagonal is a permutation of . Similar proof is applicable to another diagonal because and .
Necessity. Suppose one of the conditions does not hold. For example, let . So there exists integers p and q, such that , , . Thus the first column of is . Since , the pth element is equal to the first element. This implies that the first column is not a permutation of , which is a contradiction. The other cases are treated similarly. This completes the proof of Theorem 1. □
The following is one of the main theorems of this paper.
Theorem 2. Let , . Suppose that the following conditions are satisfied
(1) , , ;
(2) , , ;
(3) , , ;
(4) , , .
Then the preceding is a pandiagonal Latin cube, where is a permutation of , and vice versa.
Proof. We show that the conditions – are necessary and sufficient so that each surface and each diagonal section is a pandiagonal Latin square.
Because the surface is , is a necessary and sufficient condition such that is a pandiagonal Latin square. Similarly, is a necessary and sufficient condition such that is a pandiagonal Latin square.
The left surface
is given by
From Theorem 1, in order that this surface be a pandiagonal Latin square, necessary and sufficient conditions are
These are included in –.
The diagonal section
is
. It is a pandiagonal Latin square if, and only if,
These are exactly conditions in
.
The diagonal section
is given by
i.e.,
It is a pandiagonal Latin square if, and only if,
i.e.,
These conditions are also included in
–
.
The diagonal section
is
In order that this section be a pandiagonal Latin square, necessary and sufficient conditions are
i.e.,
These conditions are included in
–
.
The diagonal section
is
It is a pandiagonal Latin square if, and only if,
i.e.,
These conditions are also included in
–
.
The diagonal section
is
It is a pandiagonal Latin square if, and only if,
These conditions are also included in –.
The diagonal section
is
It is a pandiagonal Latin square if, and only if,
This is the condition
.
The diagonal section
is
It is a pandiagonal Latin square if, and only if,
These conditions are included in –. The proof is completed. □
Remark 1. We observe that if is a pandiagonal Latin cube, so is . Since conditions – of Theorem 2 are symmetric with respect to s, k.
Corollary 1. Let n be a prime number. Then ifare satisfied, is a pandiagonal Latin cube. Proof. Immediate from Theorem 2. □
Now we give the second main theorem of this paper.
Theorem 3. Suppose are pandiagonal Latin cubes. They are orthogonal if, and only if, the determinantand n are coprime, i.e., . Proof. Without loss of generality it suffices to prove that
if, and only if, number 1, which is on the common vertex
of
, cannot appear on another common place. Indeed, if 1 appears again on common place
, then there are relations
Thus there exist integers
, such that
This is a system of linear equations for
. The determinant of coefficient matrix is
From cyclic group theory [
24],
if, and only if, there is a unique solution of system (
1) with
,
,
. Since
is a solution, there is no other solution. The proof is complete. □
From this theorem we obtain the following result.
Corollary 2. Let be three pandiagonal Latin cubes of order n. In order that they are orthogonal, two necessary conditions are
Not all of are the same;
Not all of are the same.
We prove
. If
, then
It is not coprime with n. The proof of is similar.
The following theorem give a method of generating orthogonal pandiagonal Latin cubes from a given pandiagonal Latin cube.
Theorem 4. Suppose is a pandiagonal Latin cube. Choose integers α, β, , , such that Then are orthogonal pandiagonal Latin cubes.
Proof. The proof is performed in five steps. Steps (a) to (d) show that is a pandiagonal Latin cube. Step (e) shows that are orthogonal. For convenience we denote , by , , respectively.
(a) We prove
of Theorem 2, i.e.,
1. If
, i.e.,
and
n have a common factor
d which is larger than 1:
where
p and
q are positive integer,
. Substituting (
4) into (
2) yields
i.e.,
This can be written as
This means
d is a common factor of
and
n, i.e.,
. This contradicts assumptions. Thus, the relation
is true.
2. If
, then there is
which is a common factor of
and
n. So we obtain
Substituting (
6) into (
2) we obtain
i.e.,
Therefore, . This contradicts assumptions, so that we have .
3. If
, then there exists an integer
, such that
Substituting (
8) into (
2) yields
i.e.,
So . This is a contradiction. Thus .
(b) We prove
of Theorem 2, i.e.,
1. If
, then there exists
which is a common factor of
and
n:
Substituting (
10) into (3), we obtain
i.e.,
This means . This is a contradiction. So .
2. If
, then there exists
which is a common factor of
and
n:
Substituting (
12) into (3) we obtain
i.e.,
This means d is a factor of number 1, a contradiction. So .
3. If
, then
and
n have a common factor
:
Substituting (
14) into (3) yields
i.e.,
So . This is a contradiction. Thus .
(c) We prove
of Theorem 2, i.e.,
1. If
, then there exists
which is a common factor of
and
n:
Substituting (
16) into (
2) we obtain
i.e.,
By applying (3), we obtain
This means
. This is a contradiction. So
.
2. If
, then there exists
which is a common factor of
and
n:
Substituting (
18) into (
2) yields
i.e.,
Because of (3), this can be written as
i.e.,
This means . This contradicts the assumption. So .
3. If
, then there exists
which is a common factor of
and
n such that
Substituting (
20) into (
2) yields
i.e.,
Because of (3), this can be written as
i.e.,
This means . This contradicts assumption. So .
(d) We prove
of Theorem 2, i.e.,
1. If
, then
and
n have a common factor
:
Substituting (
22) into (
2) yields
i.e.,
So . This is a contradiction. Thus .
2. If
, then
and
n have a common factor
:
Substituting (
24) into (
2) yields
i.e.,
So . This is a contradiction. Thus .
3. If
, then
and
n have a common factor
:
Substituting (
26) into (
2) yields
i.e.,
So . This is a contradiction. Thus .
(a), (b), (c), and (d) above show that satisfy the conditions of Theorem 2, so that is a pandiagonal magic cube. Now we have three pandiagonal magic cubes .
(e) We now turn to prove the orthogonality of
. First, construct three determinants:
From assumptions of (
2), (3), we have
. Therefore, we obtain
Note that
, so
. Because
is a pandiagonal Latin square (third condition (2) and first condition (4) in Theorem 2),
. Compounded with
, we have
, so
. From Theorem 3 it follows that
are orthogonal. This completes the proof. □
The following theorem give another method to construct orthogonal pandiagonal Latin cubes.
Theorem 5. Suppose , . If the conditions
(1) ;
(2) ;
(3) , ;
(4)
are satisfied, then , , , are all pandiagonal Latin cubes and three of them are orthogonal.
Proof. For or , the conditions of Theorem 2 are satisfied. Then , , , are all pandiagonal Latin cubes.
In addition,
and
n are coprime if, and only if,
. However, this is true because
,
,
.
Hence from Theorem 3, any three of them are orthogonal. This completes the proof. □
Now, we can construct a pandiagonal magic cube by using Natural Aux Cube. We obtain the following theorem.
Theorem 6. Let be orthogonal pandiagonal Latin cubes. Construct integers cube , whereThen C is a pandiagonal magic cube. Proof. Consider any section or diagonal
S of
C. According to the properties of pandiagonal Latin cubes,
take the complete permutation of
on any row, column or pandiagonal line of
S. When adding the elements of
C on such a row, column, or pandiagonal, there is
They are all equal to magic sum, so C is a pandiagonal magic cube. □
If a set of orthogonal pandiagonal Latin cubes is given, we can construct 6 pandiagonal magic squares. This is because there exist six arrangements of three pandiagonal Latin squares and there are permutations of .
Next, we give some examples of satisfying the Theorems and Corollaries.
Example 1. For n = 11, computer studies show that there exist 23 pandiagonal Latin cubes which satisfy the conditions of Corollary 1, and there are 9870 orthogonal sets. For example, three orthogonal pandiagonal Latin cube sets are , , .
Example 2. Suppose n = 143.
Let , , , , , .
Then they satisfy the conditions of Theorem 3.
Example 3. For n = 121, let
, , , .
, , ,
, , ,
These are three sets of parameters such that orthogonal pandiagonal Latin cubes satisfy the conditions of Theorem 4.