The $$n\equiv 0 (mod\, 4)$$ formula

The explanation of the formula

The formula used for calculating doubly even sizes of n is the following:

In this formula p is the dimension of a magic hypercube and n the order. The symbol $$\lfloor x \rfloor$$ signifies the integral part of x, in which x in the formula above is $$ \frac{2(i_j-1)}{n}$$ . The integral is the value in front of the decimal point of any given positive number, so for instance $$\lfloor 3.14 \rfloor = \, 3$$ and $$\lfloor 9.99 \rfloor = \, 9$$. If the value in the integral is negative then the result will be the number in front of the decimal point -1, so for instance $$\lfloor -1.618 \rfloor = \, -2$$.

$$i_k$$, in which k is any value within the set $$\{1,...,n\}$$, corresponds with one of the coordinates of $$\textbf{m}(i_1,...,i_p)$$. So for instance in $$M^3_4$$ for the point $$\textbf{m}(1,2,4)$$: $$i_1 = 1$$, $$i_2 = 2$$ and $$i_3 = 4$$ and for the point $$\textbf{m}(3,4,3)$$: $$i_1 = 3$$, $$i_2 = 4$$ and $$i_3 = 3$$. Another symbol in the formula is $$\bar{i}_k$$. Where $$\bar{i}_k = n + 1 - i_k$$. So again with $$M^3_4$$ for the point $$\textbf{m}(1,2,4)$$: $$\bar{i}_1 = 4+1-1=4$$, $$\bar{i}_2 = 4+1-2 = 3$$ and $$\bar{i}_3 = 4+1-3 = 2$$ and for the point $$\textbf{m}(3,2,3)$$: $$\bar{i}_1 = 4+1-3=2$$, $$\bar{i}_2 = 4+1-4=1$$ and $$\bar{i}_3 = 4+1-3=2$$.

The formula also includes a so-called summation sign $$\sum$$. A basic form of a summation is $$\sum_{y=w}^{z}x_y$$ in which z is called the upper limit, also known as the stopping point of the summation. y is called the index of the summation. w the lower limit, also known as starting point, of the summation and $$x_y$$ the typical element of the summation. What this means is that the value y is assigned with the value of w. y is increased with 1 until it equals the value of z. Each time y increases by 1, the new value of $$x_y$$ is added to the sum of all values of $$x_y$$ which came before it, starting at $$x_w$$ and the last value of $$x_z$$. So for instance take w = 1 and z = 5 then $$\sum_{y=1}^{5}x_y = x_1 + x_2 + x_3 + x_4 + x_5$$

An example of a summation in the formula is $$\sum_{k=1}^{p}(i_k - 1)n^{k-1}$$. Filling in the bounds for the magic hypercube $$M^3_4$$ gives

$$\sum_{k=1}^{3}(i_k - 1)4^{k-1}$$

$$=(i_1 - 1)*4^0 + (i_2 - 1)*4^1 + (i_3 - 1)*4^2$$

$$ = (i_1 - 1)*1 + (i_2 - 1)*4 + (i_3 - 1)*16 $$

So not including the + 1 at the end of the calculation, the value of the point

$$\textbf{m}(3,4,3) - 1$$

$$= (3-1)*1 + (4-1)*4 + (3-1)*16 $$

$$= (2)*1 + (3)*4 + (2)*16$$

$$= 2 + 12 + 32 = 46$$

Which gives $$\textbf{m}(3,4,3) = 46 + 1 = 47$$.

The main formula itself shows 2 different sub formulas for calculating the value of $$\textbf{m}(i_1,...,i_p)$$.

Either $$ formula (1): \textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1 \, if \, \sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor)\, is\, odd$$

or $$ formula (2): \textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1 \, if \, \sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor)\, is\, even$$.

Whether to use formula (1) or formula (2) for calculating the value of $$\textbf{m}(i_1,...,i_p)$$ depends on the second part of the main formula, which is whether result of $$\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor)$$ is odd or even. If it is odd formula (1) is used and if it is even formula (2) is used.

To check if

formula (3): $$\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor)$$

is even or odd it can also be represented as

$$(\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor))(mod \, 2)$$

If the sum within the summation of formula (3) is an odd number, taking the modulo will return 1, for instance with 3/2 = 1 remainder 1, so it is equal to 1. A result of 1 from formula (3) corresponds with the usage of formula (1). If the sum within formula (3) is an even number, taking the modulo will return 0, for instance with 6/2 = 3 remainder 0, so it is equal to 0. A result of 0 from formula (3) corresponds with the usage of formula (2).

Filling in the point $$\textbf{m}(1,2,4)$$ of magic hypercube $$M^3_4$$ in formula (3) gives:

$$(\sum_{j=1}^{3}(i_j + \Big \lfloor \frac{2(i_j-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((i_1+ \Big \lfloor \frac{2(i_1-1)}{4} \Big \rfloor) + (i_2 + \Big \lfloor \frac{2(i_2-1)}{4} \Big \rfloor) + (i_3 + \Big \lfloor \frac{2(i_3-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((1+ \Big \lfloor \frac{2(1-1)}{4} \Big \rfloor) + (2 + \Big \lfloor \frac{2(2-1)}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{2(4-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((1+ \Big \lfloor \frac{2*(0)}{4} \Big \rfloor) + (2 + \Big \lfloor \frac{2*(1)}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{2*(3)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((1+ \Big \lfloor \frac{0}{4} \Big \rfloor) + (2 + \Big \lfloor \frac{2}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{6}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((1+ \lfloor 0 \rfloor) + (2 + \Big \lfloor \frac{1}{2} \Big \rfloor) + (4 + \Big \lfloor 1 + \frac{1}{2} \Big \rfloor))(mod \, 2)$$

$$ = ((1 + 0) + (2 + 0) + (4 + 1))(mod \, 2)$$

$$ = (1 + 2 + 5)(mod \, 2) $$

$$= (8)(mod \, 2) = 0$$

Which means that for calculating the value of $$\textbf{m}(1,2,4)$$ formula (2) has to be used, which gives:

$$\textbf{m}(1,2,4) = \sum_{k=1}^{3}(\bar{i}_k - 1)4^{k-1} + 1$$

$$ = \sum_{k=1}^{3}(n+1-i_k - 1)4^{k-1} + 1$$

$$ = \sum_{k=1}^{3}(4+1-i_k - 1)4^{k-1} + 1$$

$$ = \sum_{k=1}^{3}(4 - i_k )4^{k-1} + 1$$

$$ = ((4-i_1)*4^0 + (4-i_2)*4^1 + (4-i_3)*4^2)+1$$

$$ = ((4-1)*4^0 + (4-2)*4^1 + (4-4)*4^2)+1$$

$$ = (3)*1 + (2)*4 + (0)*16 + 1$$

$$ = 3 + 8 + 0 + 1 = 12 $$

So in the magic hypercube $$M^3_4$$ the point $$\textbf{m}(1,2,4) = 12$$.

Filling in the point $$\textbf{m}(3,4,3)$$ from magic hypercube $$M^3_4$$ in formula (3) gives:

$$(\sum_{j=1}^{3}(i_j + \Big \lfloor \frac{2(i_j-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((i_1+ \Big \lfloor \frac{2(i_1-1)}{4} \Big \rfloor) + (i_2 + \Big \lfloor \frac{2(i_2-1)}{4} \Big \rfloor) + (i_3 + \Big \lfloor \frac{2(i_3-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((3+ \Big \lfloor \frac{2(3-1)}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{2(4-1)}{4} \Big \rfloor) + (3 + \Big \lfloor \frac{2(3-1)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((3+ \Big \lfloor \frac{2*(2)}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{2*(3)}{4} \Big \rfloor) + (3 + \Big \lfloor \frac{2*(2)}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((3+ \Big \lfloor \frac{4}{4} \Big \rfloor) + (4 + \Big \lfloor \frac{6}{4} \Big \rfloor) + (3 + \Big \lfloor \frac{4}{4} \Big \rfloor))(mod \, 2)$$

$$ = ((3+ \lfloor 1 \rfloor) + (4 + \Big \lfloor 1 + \frac{1}{2} \Big \rfloor) + (3 + \lfloor 1 \rfloor))(mod \, 2)$$

$$ = ((3 + 1) + (4 + 1) + (3 + 1))(mod \, 2)$$

$$ = (4 + 5 + 4)(mod \, 2)$$

$$= (13)(mod \, 2) = 1$$

$$= (13)(mod \, 2) = 1$$

Therefore, the calculation of the value of point $$\textbf{m}(3,4,3)$$ from magic hypercube $$M^3_4$$ is done with formula (1), which was previously shown to equal 47.

So for the calculation of each point within $$M^p_n$$ when $$n\equiv 0 (mod\, 4)$$, first formula (3) will be used to determine whether to use formula (1) or (2) to calculate the value of the point and then the value of the point will be calculated with either formula (1) or (2) depending on the result from formula (3).

The proof of the formula

To prove that the $$n\equiv 0 (mod\, 4)$$ formula always creates a simple magic hypercube filled with consecutive numbers starting from 1, the following 4 requirements have to be proven:

  1. Each coordinate within $$M^p_n$$ has a value that is a number in $$\{ 1,...,n^p\}$$
  2. No 2 points within $$M^p_n$$ with different coordinates have the same value
  3. Each row has the same sum , which equals the magic constant
  4. Each main diagonal has the same sum as that of the rows and also equals the magic constant

The following 4 sub-chapters named proof for requirements 1 through 4, will show proof for each of these requirements.

Proof For Requirement 1

To show that each coordinate within $$M^p_n$$ has a value in the interval $$\{ 1,...,n^p\}$$ the two points $$\textbf{m}(1,1,...,1,1)$$, in which every coordinate is equal to 1, and the point $$\textbf{m}(n,n,...,n,n)$$, in which every coordinate is equal to n, will be used. These two points either have the highest or lowest value assigned to them, depending on whether formula (1) or formula (2) is used. Whether to use formula (1) or formula (2) depends on the outcome of formula (3) as mentioned previously. When each coordinate within $$\textbf{m}(i_1,...,i_p)$$ is the same, the equation of formula (3) can be simplified. In the case of $$\textbf{m}(1,1,...,1,1)$$, formula (3) can be rewritten as follows since the value of $$i_j$$ is always equal to 1:

$$(\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(1+ \Big \lfloor \frac{2(1-1)}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(1+ \Big \lfloor \frac{2(0)}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(1+ \Big \lfloor \frac{0}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(1+ \lfloor 0 \rfloor))(mod \, 2)$$

$$ = (p*(1 + 0))(mod \, 2)$$

$$ = (p*(1))(mod \, 2)$$

$$ = (p)(mod \, 2)$$

$$\sum_{j=1}^{p} = p $$, because the value within the summation is the same every time. Adding the same value p times is the same as multiplying the value by p. This property of a summation will be used in rewriting other summations later as well.

Since $$ (\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor))(mod \, 2) = (p)(mod \, 2)$$, if the dimension of the magic hypercube is even, the result of formula (3) for point $$\textbf{m}(1,1,...,1,1)$$ is 0, so formula (2) is used and if the dimension is odd then formula (1) is used.

Filling in point $$\textbf{m}(n,n,...,n,n)$$ in formula (3) gives:

$$(\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(n+ \Big \lfloor \frac{2(n-1)}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(n+ \Big \lfloor \frac{2n-2}{n} \Big \rfloor))(mod \, 2)$$

$$ = (p*(n+ \Big \lfloor 2-\frac{2}{n} \Big \rfloor))(mod \, 2$$

$$ = (p*(n + 1))(mod \, 2)$$

$$ = (n*p + p)(mod \, 2)$$

Since n is always an even number because this formula is only used when $$n\equiv 0 (mod\, 4)$$, $$n(mod\, 2) = 0$$, which gives

$$(0*p + p)(mod\, 2) = (p)(mod \, 2)$$

So just like with the point $$\textbf{m}(1,1,...,1,1)$$, filling $$\textbf{m}(n,n,...,n,n)$$ in formula (3) will result in 0 when the dimension is an even number, so formula (2) has to be used and formula (3) results in 1 when the dimension is an odd number, resulting in the use of formula (1).

So as shown previously, when p is odd, $$\textbf{m}(1,1,...,1,1)$$ and $$\textbf{m}(n,n,...,n,n)$$ are calculated with formula (1). filling in point $$\textbf{m}(1,1,...,1,1)$$ gives

$$\textbf{m}(1,1,...,1,1)$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(1 - 1)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(0)n^{k-1} + 1$$

$$ = 0 + 1 = 1$$

Which is the minimum, because if a different coordinate is filled in with a number larger than 1, the result of the equation $$i_k-1 > 0$$ results in the multiplication with the corresponding value of $$n^{k-1}$$. Filling in the point $$\textbf{m}(n,n,...,n,n)$$ when p is odd in formula (1) gives

$$\textbf{m}(n,n,...,n,n)$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(n - 1)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(n*n^{k-1} - n^{k-1}) + 1$$

$$ = \sum_{k=1}^{p}(n^{k} - n^{k-1}) + 1$$

$$ = n^{p} - 1 + 1 = n^p$$

$$ \sum_{k=1}^{p}(n^{k} - n^{k-1}) = n^{p} - 1 $$ because

$$ (n^1 - n^0) + (n^2 - n^1) + ... + (n^{p-1} - n^{p-2}) + (n^p - n^{p-1})$$

$$ = -n^0 + n^1 - n^1 + n^2 - n^2 + ... + n^{p-2} - n^{p-2} + n^{p-1} - n^{p-1} + n^{p}$$

$$ = -n^0 + 0 + 0 + ... + 0 + 0 + n^p$$

$$ = n^p - n^0 = n^p - 1$$

Since the increasing of the value of a coordinate increases the result of $$\textbf{m}(i_1,...,i_p)$$ when using formula (1), having the maximum value for each coordinate, which is n, will give the maximum value of $$\textbf{m}(i_1,...,i_p)$$.

Therefore, the minimum result of formula (1) is 1 and the maximum $$n^p$$.

Now to prove formula (2), which is needed when p is even, points $$\textbf{m}(1,1,...,1,1)$$ and $$\textbf{m}(n,n,...,n,n)$$ will be filled into formula (2)

Filling in $$\textbf{m}(1,1,...,1,1)$$ gives

$$\textbf{m}(1,1,...,1,1)$$

$$ = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(n - i_k + 1 - 1)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(n - i_k)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(n - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(n^k -n^{k-1}) + 1$$

$$ = n^p - 1 + 1 = n^p$$

and filling in $$\textbf{m}(n,n,...,n,n)$$ in formula 2 gives

$$\textbf{m}(n,n,...,n,n)$$

$$ = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(n - i_k + 1 - 1)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(n - n)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(0)n^{k-1} + 1$$

$$= 0 + 1 = 1$$

Since increasing the value of a coordinate only results in a lower result of formula (2), the point with the lowest coordinates, being $$\textbf{m}(1,1,...,1,1)$$, will equal the maximum and the point with the largest coordinates, being $$\textbf{m}(n,n,...,n,n)$$, will equal the maximum result. Therefore, the result of formula (2) also lie within the set $$\{1,...,n\}$$.

So for an odd p $$\textbf{m}(1,1,...,1,1)$$ has the minimum value and $$\textbf{m}(n,n,...,n,n)$$ the maximum. For an even p $$\textbf{m}(1,1,...,1,1)$$ has the maximum value and $$\textbf{m}(n,n,...,n,n)$$ has the minimum value. Because there is only a subtraction of 1 and the value of both $$i_k$$ and $$\bar{i}_k$$ are any integer of the set $$\{1,...,n\}$$, the equation will never go negative and there are no fractions, therefore, each coordinate within $$M^p_n$$ has a value that is a number in $$\{ 1,...,n^p\}$$ which completes the proof for requirement 1.

Proof For Requirement 2

To prove requirement 2 it has to be proven that no 2 points within $$M^p_n$$ with different coordinates have the same value. To prove this, the summation in formula 1 and 2 will be looked at again. In formula (1)

$$\textbf{m}(i_1,,...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

The part $$(i_k -1)$$ can be any number in the set $$\{0,...,n-1\}$$ due to $$i_k$$ being any number in the set $$\{1,...,n\}$$. The value of $$i_k$$ is a number from the set $$\{1,...,n\}$$ because according to the definition $$|m(i_1,...,i_p):1\leq i_1,...,i_p\leq n|$$ for any point in a magic hypercube $$M^p_n$$ the minimum is one and the maximum n. By increasing the value of $$i_k$$, the result of $$(i_k -1)$$ will increase, which causes a larger multiplication with $$n^{k-1}$$ resulting in a higher end value. The result of $$(i_k - 1)n^{k-1}$$ will never be larger than the following term of k, being $$n^k$$, as the maximum value that a certain k will get to is $$(n-1)n^{k-1} = (n^k - n^{k-1})$$. This means that if $$i_k = n$$, the maximum value that $$i_k$$ can be according to the interval $$\{1,...,n\}$$, and $$i_{k+1} = 1$$, the minimum value from the interval $$\{1,...,n\}$$, the $$i_k$$ will not be able to take the place of $$i_{k+1}$$ by generating the same value. The $$n^{k-1}$$ can also not be reached by lower k values, as for instance $$i_{k-1} = n$$ gives $$(n-1)n^{k-2} = (n^{k-1} - n^{k-2})$$. Adding the result of $$i_{k-1} = n$$ and $$i_k = n$$ gives $$i_{k}+i_{k-1} = (n^{k} - n^{k-1}) + (n^{k-1} - n^{k-2}) = n^{k} - n^{k-2}$$. Adding $$i_{k-2} = n$$ and onwards will only change subtraction from $$n^{k}$$ to a lower amount, but it will never become zero. Therefore, no 2 different points will have the same result from formula (1). The same goes for formula (2), but there when the value of $$i_k$$ increases the value of the sum becomes smaller, but the result of $$(\bar{i}_k-1)$$ will also be in the set $$\{0,...,n-1\}$$.

The only way that 2 duplicate values could occur is if in the magic hypercube $$M^p_n$$ two different points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ follow the relation where all coordinates $$i_ j$$ in one point have the relationship $$i_j = n-i'_j+1$$ with all coordinates $$i'_j$$ in the other points. In which $$j$$ is every number from the set $$\{1,...,p\}$$.

Since $$i_j = n-i'_j+1$$

also means that $$i'_j = n-i_j+1$$

$$\textbf{m}(i'_1,...,i'_p)$$ can also be written as $$\textbf{m}(n-i_1+1,...,n-i_p+1)$$

If the calculation of the value for point $$\textbf{m}(i_1,...,i_p)$$ were to follow formula (1) and the calculation of the value of point $$\textbf{m}(n-i_1+1,...,n-i_p+1)$$ formula (2) the following would occur:

When the point $$\textbf{m}(i_1,...,i_p)$$ is filled in to formula (1)

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

and if the point $$\textbf{m}(i'_1,...,i'_p)$$ is filled in to formula (2)

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(\bar{i'}_k - 1)n^{k-1} + 1$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-i'_k +1 - 1)n^{k-1} + 1$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-i'_k)n^{k-1} + 1$$

since $$\textbf{m}(i'_1,...,i'_p) = \textbf{m}(n-i_1+1,...,n-i_p+1)$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-(n-i_k+1)n^{k-1} + 1$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-n+i_k-1)n^{k-1} + 1$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(i_k-1)n^{k-1} + 1$$

Which is exactly the same summation as the one when calculating the value of $$\textbf{m}(i_1,...,i_p)$$ with formula (1), therefore, $$\textbf{m}(i_1,...,i_p) = \textbf{m}(i'_1,...,i'_p)$$ in this case. This would cause duplicate points in $$M^p_n$$. The same occurs when $$\textbf{m}(i_1,...,i_p)$$ is calculated with formula (2) and $$\textbf{m}(i'_1,...,i'_p)$$ with formula (1):

Calculating the value of point $$\textbf{m}(i_1,...,i_p)$$ with formula (2) gives:

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(n-i_k+1 - 1)n^{k-1} + 1$$

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(n-i_k)n^{k-1} + 1$$

And the calculation of $$\textbf{m}(i'_1,...,i'_p)$$ with formula (1) gives:

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(i'_k - 1)n^{k-1} + 1$$

again since $$\textbf{m}(i'_1,...,i'_p) = \textbf{m}(n-i_1+1,...,n-i_p+1)$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-i_k+1 - 1)n^{k-1} + 1$$

$$\textbf{m}(i'_1,...,i'_p) = \sum_{k=1}^{p}(n-i_k)n^{k-1} + 1$$

Which means that $$\textbf{m}(i_1,...,i_p) = \textbf{m}(i'_1,...,i'_p)$$, as the summations are the same for $$\textbf{m}(i'_1,...,i'_p)$$ when using formula (1) and $$\textbf{m}(i_1,...,i_p)$$ when formula (2). Therefore, when the same formulas are used to calculate the value of $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ the results are the same. These values, however, are not the same when the formula used is the same. If formula (1) is used for both points, then the summation part in the calculation of the point $$\textbf{m}(i_1,...,i_p)$$ contains $$(i_k+1)$$ and that of $$\textbf{m}(i'_1,...,i'_p)$$ contains $$(n-i_k)$$. These would give the same results if $$(i_k+1)=(n-i_k)$$:

$$i_k+1=n-i_k$$

$$2i_k=n+1$$

$$i_k=\frac{n+1}{2}$$

This is impossible because n is always an even number when the $$n\equiv 0 (mod\, 4)$$ formula is used. Adding 1 to an even number gives an odd number and dividing an odd number by 2 always results in a number with decimal points. Since $$i_k$$ is always an integer, it can never equal the result of the fraction and, therefore, $$i_k+1\neq n-i_k$$.

The proof of formula (2) resulting in different values is the same, only now the summation within formula (2) when calculating $$\textbf{m}(i_1,...,i_p)$$ contains $$(n-i_k)$$ and that of $$\textbf{m}(i'_1,...,i'_p)$$ contains $$(i_k+1)$$. Therefore, when both the value of $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ are calculated with the same formula and their result will be different.

To show that the calculation for $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ follow the same formula it is important to realise that in points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p) = \textbf{m}(n-i_1+1,...,n-i_p+1)$$, if $$i_j$$ is an odd number, then $$n-i_j+1$$ is even, because n is an even number and an even number minus an odd number is an odd number and an odd number - 1 is an even number. If $$i_j$$ is an even number, then $$n-i_j+1$$ is odd, because n is an even number and an even number minus an even number is even and an even number - 1 is an odd number. So in any case the parity of $$i_j$$ and $$n-i_j+1$$ will differ. To counteract one being even and the other odd, formula (3) contains the part (3.1):

(3.1)$$\Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor$$

The result of (3.1) will always be 0 or 1, because the maximal value of $$i_j = n$$ due to the definition of the formula. $$i_j$$ will always be subtracted by 1, meaning that after the multiplication of 2 the numerator of the equation will never be equal or higher than $$2n$$ but will cap out at $$2n-2$$. A value of $$2n$$ would result in the value of 2 after the division of n and after taking the integral, but because this is not possible (3.1) will cap out at 1. The lowest value that $$i_j$$ can equal is 1. Filling this into formula (3.1) gives

$$\Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor$$

$$= \Big \lfloor \frac{2(1-1)}{n} \Big \rfloor$$

$$= \Big \lfloor \frac{2(0)}{n} \Big \rfloor$$

$$= \Big \lfloor \frac{0}{n} \Big \rfloor$$

$$= \lfloor 0 \rfloor = 0$$

Therefore, the minimum result of (3.1) is 0 and thus the value of (3.1) will be either 0 or 1 as there can not be any decimal numbers due to the integral in the equation.

Whether (3.1) is 1 can be represented as follows:

$$\Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor = 1 \, when$$

$$2(i_j-1) \geq n$$

$$i_j-1 \geq \frac{n}{2}$$

$$i_j \geq \frac{n}{2}+1$$

The last step can be done because $$i_j$$ always increase by 1

What this shows is that (3.1) is 0 when the value of $$i_j$$ is smaller or equal to half of the size of the magic hypercube and equal to 1 when the value of $$i_j$$ is larger than half of the size of the magic hypercube.

So for each coordinate in $$\textbf{m}(i_1,...,i_p)$$

$$\Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor = 1 \, when$$

$$i_j \geq \frac{n}{2}+1$$

And for each coordinate in and $$\textbf{m}(i'_1,...,i'_p)$$

$$\Big \lfloor \frac{2(i'_j-1)}{n} \Big \rfloor = 1$$

$$\Big \lfloor \frac{2(n-i_j+1-1)}{n} \Big \rfloor = 1$$

$$\Big \lfloor \frac{2(n-i_j)}{n} \Big \rfloor = 1 \, when$$

$$n-i_j > \frac{n}{2}$$

$$-i_j > -\frac{n}{2}$$

$$i_j < \frac{n}{2}$$

Which shows that whatever value of is $$i_j$$ the result of (3.1) is 0 for one of the points and 1 for the other as $$i_j \geq \frac{n}{2}+1$$ and $$i_j < \frac{n}{2}$$ cannot be both true.

So to recap, given two points in the magic square $$M^p_n$$ in which all coordinates $$i_j$$ and $$i'_j$$ have the relationship $$i_j = n-i'_j+1$$ then both of their values are calculated with the same formula, being either formula (1) or (2). This is the case because per coordinate if $$i_j$$ is odd then $$i'_j$$ and when $$i_j$$ is even $$i'_j$$ is odd. To counterbalance, formula (3) has the part (3.1) which adds 1 in the summation for either $$i_j$$ or $$i'_j$$ per coordinate. When two values have a different parity, adding one to one of those values causes them to have the same parity. Therefore, the parity of the result of formula (3.1) for each coordinate is always the same and thus the parity of the result of formula (3) for both points will be the same. Thus, both points will follow the same formula and consequently no duplicate values will occur for different points when using the $$n\equiv 0 (mod\, 4)$$ formulas, which completes the proof for requirement 2.

Proof For Requirement 3

Requirement 3 states that each line has to add up to the same value. A line is a set of points in which all coordinates are equal except for 1 which alternates. The coordinate that alternates is $$i_j$$ in which j is any value of the set $$\{ 1,...,p\}$$. To show that a line is equal to the magic constant, coordinate pairs which consist of two points with the same coordinates except for $$i_j$$, in which $$i_j$$ is odd for the first point of the pair and for the second point coordinate $$i_j$$ has the same value as the coordinate $$i_j$$ of the first point of the pair, but 1 is added to the value. So the first point of the pair is $$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p)$$ and the second $$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p)$$, in which the original value of $$i_j$$ is the same for both points. Because the coordinate $$i_j$$ of the first point of the pair is odd and the value of the second one is consequently even due to the addition of 1, the calculation for one of the points makes use of formula (1) and the other of formula (2). This is because the result of formula (3) $$(\sum_{j=1}^{p}(i_j + \Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor))(mod \, 2)$$

before the modulo is increased by 1 when calculating the value of the second point due to the $$i_j$$ in front of the integral part of the calculation and, therefore, one will be even and the other odd. The (3.1) part $$\Big \lfloor \frac{2(i_j-1)}{n} \Big \rfloor$$ of formula (3) will not change this because its result will be the same for both points. This is because the result of (3.1) is 1 when $$i_j \geq \frac{n}{2}+1$$and 0 when $$i_j < \frac{n}{2}+1$$ meaning that there is a turning point from 0 to 1 when $$i_j = \frac{n}{2}+1$$. The result of formula (3.1) with the point $$i_j$$ and $$i_j + 1$$ will not be different, however, because $$\frac{n}{2}+1$$ is always an odd number as n is a doubly even number, which means that $$\frac{n}{2}$$ will always result in an even number and, therefore, $$\frac{n}{2}+1$$ is always odd. So, for $$i_j + 1$$ to be equal to the turning point $$\frac{n}{2}+1$$ its sum needs to be odd. This is impossible, however, as $$i_j$$ is odd, meaning that the result of $$i_j + 1$$ will always be even. This means that in each point pair $$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p)$$ and $$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p)$$ one point’s value is calculated with formula (1) and the other with formula (2).

So to get the addition of a point pair formula (1) and (2) have to be added, which gives the following ($$\bar{i}_k$$ has been changed to $$\bar{h}_k$$ to show that the coordinates filled into formula (2) are different from those filled in formula (1)):

$$\sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1 + \sum_{k=1}^{p}(\bar{h}_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(\bar{h}_k - 1)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(n-h_k + 1- 1)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(n-h_k)n^{k-1} + 2$$

The summations can be added because all elements of the summation are the same except for the typical element. This gives:

$$ = \sum_{k=1}^{p}(i_k - 1 + n-h_k)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k*n^{k-1} - 1*n^{k-1} + n*n^{k-1}-h_k*n^{k-1}) + 2$$

$$ = \sum_{k=1}^{p}(i_k*n^{k-1} - n^{k-1} + n^{k}-h_k*n^{k-1}) + 2$$

$$ = \sum_{k=1}^{p}((i_k-h_k)n^{k-1} - n^{k-1} + n^{k}) + 2$$

Just like how the two summations could be added, they can be separated. This gives:

$$ = \sum_{k=1}^{p}((i_k-h_k)n^{k-1}) + \sum_{k=1}^{p}(n^{k} - n^{k-1}) + 2 $$

$$= \sum_{k=1}^{p}((i_k-h_k)n^{k-1}) + n^p - 1 + 2$$

$$ = \sum_{k=1}^{p}((i_k-h_k)n^{k-1}) + n^p + 1$$

So say point $$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p)$$ follows formula (1) and point $$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p)$$ follows formula (2).

$$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

and

$$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p) = \sum_{k=1}^{p}(\bar{h}_k - 1)n^{k-1} + 1$$

The subtraction of $$(i_k - h_k)$$ for every value of k will equal 0, as $$i_k = h_k$$, except when $$k=j$$. In that case $$(i_k - h_k) = 1$$ because $$h_k = i_k +1$$. Therefore,

$$\sum_{k=1}^{p}((i_k-h_k)n^{k-1}) + n^p + 1 = (1)n^{j-1} + n^p + 1 = n^{j-1} + n^p + 1$$.

If point $$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p)$$ follows formula (1) and point $$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p)$$ follows formula (2) then

$$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

and

$$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p) = \sum_{k=1}^{p}(\bar{h}_k - 1)n^{k-1} + 1$$

then $$(i_k - h_k) = -1$$, which means that

$$\sum_{k=1}^{p}((i_k-h_k)n^{j-1}) + n^p + 1 = (-1)n^{j-1} + n^p + 1 = -n^{j-1} + n^p + 1$$.

Adding a pair of which the addition of the values is $$-n^{j-1} + n^p + 1$$ with another pair of which the addition is $$n^{j-1} + n^p + 1$$ gives

$$-n^{j-1} + n^p + 1 + n^{j-1} + n^p + 1 = 2n^p + 2$$

To find which two pairs to add, add $$\frac{n}{2}$$ to $$i_j$$ if $$i_j \leq n$$ or subtract $$\frac{n}{2}$$ from $$i_j$$ if $$i_j > n$$. This works because an even number is added so the total sum of (3) should keep its original parity, but (3.1) changes as the switching point $$i_j = \frac{n}{2}+1$$ is passed when adding or subtracting $$\frac{n}{2}$$. Therefore, the parity of (3) changes and so the formula for the point with the coordinate $$i_j$$ in the first pair of points is different from that of the point with the coordinate $$i_j$$ in the second pair. The parity of the result of (3) also changes for the point with $$i_j+1$$ in the first pair and the second pair.

So a double point pair that suffices these requirement would have the form:

$$\textbf{m}(i_1,...,i_{j-1},i_j,i_{j+1},...,i_p)$$,

$$\textbf{m}(i_1,...,i_{j-1},i_j+1,i_{j+1},...,i_p)$$

$$\textbf{m}(i_1,...,i_{j-1},i_j \pm \frac{n}{2},i_{j+1},...,i_p)$$

$$\textbf{m}(i_1,...,i_{j-1},i_j \pm \frac{n}{2} + 1,i_{j+1},...,i_p)$$

Since there are $$\frac{n}{2}$$ point before the switching point $$i_j = \frac{n}{2}+1$$ and $$\frac{n}{2}$$ there will always be an equal amount of points on both sides of the switching point.

There are 4 points needed for this double pair. For every n that uses this formula the size is a factor of 4 as this formula is for $$n\equiv 0 (mod\, 4)$$ and, therefore, a whole amount of double pairs are possible. In total there are n points in a line, so the total number of combined pairs are $$\frac{n}{4}$$. This means that the total sum of one line is:

$$\frac{n}{4} * (2n^p + 2) = \frac{n(2n^p + 2)}{4}= \frac{2n(n^p + 1)}{4} = \frac{n(n^p + 1)}{2}$$

This is equal to the magic constant which completes the proof for requirement 3.

Proof For Requirement 4.

To prove that each main diagonal equals the same value pairs will be made again. One of the points of the pair is $$\textbf{m}(i_1,...,i_p)$$ and the other point is $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$. As shown before in proof 1 and 2, the eventual value that is added in the summation of formula (3) for each coordinate $$i_j$$ and $$\bar{i}_j$$ have the same parity, therefore, $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$ will follow the same formula, as all the coordinates within $$\textbf{m}(i_1,...,i_p)$$ of the form $$i_j$$ and $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$ are of the form $$\bar{i_j}$$ with j being a number of the set $$\{1,...,p\}$$.

This means that if formula (1) has to be used the sum of points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$ is:

Filling in $$\textbf{m}(i_1,...,i_p)$$ in formula (1) gives

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

and filling in point $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$ in formula (1) gives

$$\textbf{m}(\bar{i}_1,...,\bar{i}_p) = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

Thus

$$\textbf{m}(i_1,...,i_p) + \textbf{m}(\bar{i}_1,...,\bar{i}_p)$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1+ \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(n - i_k + 1 - 1)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k - 1)n^{k-1} + \sum_{k=1}^{p}(n - i_k)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(i_k - 1 + n - i_k)n^{k-1} + 2$$

$$ = \sum_{k=1}^{p}(n - 1)n^{k-1} + 2$$

$$ = n^p - 1 + 2 = n^p + 1$$

And if formula (2) is used for both points then

Filling in $$\textbf{m}(i_1,...,i_p)$$ in formula (2) gives

$$\textbf{m}(i_1,...,i_p) = \sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1$$

and filling in point $$\textbf{m}(\bar{i}_1,...,\bar{i}_p)$$ in formula (2) gives

$$\textbf{m}(\bar{i}_1,...,\bar{i}_p) = \sum_{k=1}^{p}(n-\bar{i}_k)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(n-(n-i_k+1))n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(n-n+i_k-1)n^{k-1} + 1$$

$$= \sum_{k=1}^{p}(i_k-1)n^{k-1} + 1$$

Therefore,

$$\textbf{m}(i_1,...,i_p) + \textbf{m}(\bar{i}_1,...,\bar{i}_p) =\sum_{k=1}^{p}(\bar{i}_k - 1)n^{k-1} + 1 + \sum_{k=1}^{p}(i_k - 1)n^{k-1} + 1$$

which is exactly the same as the proof for formula (1). Therefore, each pair will be equal to $$n^p + 1$$. There are 2 numbers used for a pair and there are n numbers in each diagonal. Since this formula is only used when $$n\equiv 0 (mod\, 4)$$, n is always even so, therefore, there will always be an even amount of pairs. So the total value of a diagonal will be

$$(n^p + 1)*\frac{n}{2} = \frac{n(n^p + 1)}{2}$$

which is equal to the magic constant, which both completes the proof of requirement 4 and the proof of the formula of $$n\equiv 0 (mod\, 4)$$.