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

Proof for impossibility of magic hypercube with $$n = 2$$ and $$p>1$$

Before showing the $$n\equiv 2 (mod\, 4)$$ formula it is first important to show why the magic hypercube $$M_2^p$$, which is one of the values that should follow the $$n\equiv 2 (mod\, 4)$$ statement, is impossible. The formula of the magic constant for the magic hypercube $$M_2^p$$ gives

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

The values of all the points in the magic hypercube $$M_2^p$$ are in the set $$\{1,...,2^p\}$$. As there are no duplicate numbers each number can only appear once. Given the point with the value of 1, than the point with which is can create a line needs to have the value:

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

There is only one point that can have the value $$2^p$$ and this value can not be split up into 2 different points as there are only 2 points in each row of which the value 1 was one. This means that to be able to create a $$M_2^p$$ each point can only be in one row. This is not possible however as was shown previously in the proof for the magic constant because each point is part of p lines. This means that if $$p > 1$$ no magic hypercube for $$M_2^p$$ is possible.

The explanation of the formula

For the other magic hypercubes that are not $$n = $$2 and follow $$n\equiv 2 (mod\, 4)$$ the formula goes as follows:

formula (7) $$\textbf{m}(i_1,...,i_p) = \textbf{m}_{(k)}(i^*_1,...,i^*_p)$$

In which

formula (8) $$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

Where $$m = n/2$$

in formula (7) $$i^*_x = min\{i_x,\bar{i}_x\} = min\{i_x,n+1-i_x\}$$

Which means that $$i^*_x$$ will be either $$i_x$$ or $$(n+1-i_x)$$ depending on which one of the two is lower. So given the magic hypercube $$M_6^3$$ with the point $$\textbf{m}(2,4,6)$$.

$$i^*_1 = min\{i_1,n+1-i_1\} = min\{2,6+1-2\} = min\{2,5\} = 2$$

$$i^*_2 = min\{i_1,n+1-i_2\} = min\{4,6+1-4\} = min\{4,3\} = 3$$

$$i^*_3 = min\{i_1,n+1-i_3\} = min\{6,6+1-6\} = min\{6,1\} = 1$$

What $$i^*_x$$ essentially accomplishes is that the highest value that will be put into $$\textbf{m}_{(k)}(i^*_1,...,i^*_p)$$ is n/2. Because $$i_x = n/2$$ gives the following.

$$i^*_x = min\{i_x,n+1-i_x\} = min\{n/2,n+1-n/2\} = min\{n/2,1+n/2\} = n/2 $$

Filling in $$i_x = n/2+1$$ gives the same result:

$$i^*_x = min\{i_x,n+1-i_x\} = min\{n/2+1,n+1-(n/2+1)\} = min\{n/2+1,n/2\} = n/2 $$

Filling in a higher or lower value will only decrease the value $$i_x$$ take $$i_x = n/2 +2 $$ for instance:

$$i^*_x = min\{i_x,n+1-i_x\} = min\{n/2+2,n+1-(n/2+2)\} = min\{n/2+2,n/2-1\} = n/2-1 $$

and $$i^*_x = n/2 - 1 $$ gives

$$i^*_x = min\{i_x,n+1-i_x\} = min\{n/2-1,n+1-(n/2-1)\} = min\{n/2-1,n/2+2\} = n/2-1 $$

The minimum values that $$i^*_x$$ can equal are given for $$i_x = 1$$ and $$i_x = n$$ as $$1 \leq i_x \leq n$$ which give the following

For $$i_x = 1$$

$$i^*_x = min\{i_x,n+1-i_x\} = min\{1,n+1-0\} = min\{1,n+1\} = 1 $$

And for $$i_x = n$$

$$i^*_x = min\{i_x,n+1-i_x\} = min\{n,n+1-n\} = min\{n,1\} = 1 $$

Because of this the value of $$i^*_x$$ can equal any number from the set $$\{1,...,n/2\}$$ which can also be written as $$\{1,...,m\}$$

The next part of the formula is:

formula (9) $$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

$$\textbf{m}(i_1,...,i_p)$$ in formula (9) is a point in the magic hypercube $$M^p_m$$. Since m is always odd because values that follow the requirement $$n\equiv 2 (mod\, 4)$$ are singly even and a singly even number divided by 2 is odd, $$M^p_m$$ construction follows formula used for $$n\equiv 1 (mod\, 2)$$. Mathematical proof for this will be shown in the explanation of requirement 1.

next,

formula (10) $$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$

In which $$ \textbf{d}(q,k)$$ corresponds with a cell within table $$\textbf{D}$$. Table $$\textbf{D}$$ is defined as: $$|\textbf{d}(j,x) : 1 \leq j \leq m, 1 \leq x \leq 2^p |$$. This means that table $$\textbf{D}$$ has m rows and p columns. The calculations for the value of each cell is the following

(11) $$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

(12) $$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

(13) $$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

(14) $$\textbf{d}(j,x) = x-1, \, j=4,6,8,10,...,m-1$$

(15) $$\textbf{d}(j,x) = 2^p-x, \, j=5,7,9,11,...,m$$

The last formula needed for the construction of magic hypercubes which follow $$n\equiv 2 (mod\, 4)$$ is

(16) $$q = \textbf{u}(i_1,...,i_p) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1$$

The q can be found back in $$ \textbf{d}(q,k)$$ and signifies which row of table $$\textbf{D}$$ to use.

So given point $$\textbf{m}(2,4,6)$$ in the magic hypercube $$M_6^3$$. The calculation of the value of $$\textbf{m}(2,4,6)$$ would go as follows:

First its k value is calculated with formula (8)

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{3}\Big \rfloor*2^{x-1}) + 1$$

$$=(\Big \lfloor \frac{2-1}{3}\Big \rfloor*2^{1-1})+(\Big \lfloor \frac{4-1}{3}\Big \rfloor*2^{2-1})+(\Big \lfloor \frac{6-1}{3}\Big \rfloor*2^{3-1})+1$$

$$=(\Big \lfloor \frac{1}{3}\Big \rfloor*2^{0})+(\Big \lfloor \frac{3}{3}\Big \rfloor*2^{1})+(\Big \lfloor \frac{5}{3}\Big \rfloor*2^{2})+1$$

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

$$=2+4+1 = 7$$

So filling this into formula (7) gives

$$\textbf{m}(2,4,6) = \textbf{m}_{(7)}(2^*,4^*,6^*) $$

$$= \textbf{m}_{(7)}(\min\{2,6-2+1\},\min\{4,6-4+1\},\min\{6,6-6+1\})$$

$$= \textbf{m}_{(7)}(\min\{2,5\},\min\{4,3\},\min\{6,1\})$$

$$= \textbf{m}_{(7)}(2,3,1)$$

Formula (9) gives

$$\textbf{m}_{(7)}(2,3,1) = \textbf{v}_{(7)}(2,3,1)3^3 + \textbf{m}(2,3,1)$$

Formula (10) gives

$$ \textbf{v}_{(7)}(2,3,1)3^3 + \textbf{m}(2,3,1) = \textbf{d}(\textbf{u}_{(7)}(2,3,1),7)27 + \textbf{m}(2,3,1)$$

$$\textbf{u}_{(7)}(2,3,1)$$ is calculated with formula (16) which gives:

Filling in formula (16) gives

$$\textbf{u}_{(7)}(2,3,1) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, 3)+1$$

$$=(((-1)^{1-1}2)+((-1)^{2-1}3)+((-1)^{3-1}1))(mod \, 3)+1$$

$$=(((-1)^{0}2)+((-1)^{1}3)+((-1)^{2}1))(mod \, 3)+1$$

$$=((1*2)+(-1*3)+(1*1))(mod \, 3)+1$$

$$(2+-3+1)(mod \, 3)+1$$

$$(0)(mod \, 3)+1 = 1$$

Thus $$\textbf{u}_{(7)}(2,3,1) = 1$$

Filling this back into $$ \textbf{d}(\textbf{u}_{(7)}(2,3,1),7)27 + \textbf{m}(2,3,1)$$ gives

$$ \textbf{d}(1,7)27 + \textbf{m}(2,3,1)$$

Since the first coordinate of $$\textbf{d}(1,7)$$ is 1, formula (11) has to be used to calculate its values, which gives:

$$ (2^{3-1}*2^{7(mod \, 2)}-\Big \lfloor \frac{7+1}{2} \Big \rfloor)27 + \textbf{m}(2,3,1)$$

$$ =(2^{2}*2^{1}-\Big \lfloor \frac{8}{2} \Big \rfloor)27 + \textbf{m}(2,3,1)$$

$$ =(4*2-4)27 + \textbf{m}(2,3,1)$$

$$ =(8-4)27 + \textbf{m}(2,3,1)$$

$$ =(4)27 + \textbf{m}(2,3,1)$$

$$ =108 + \textbf{m}(2,3,1)$$

Calculating the value of $$\textbf{m}(2,3,1)$$ is done with formula (4), (5) and (6) from the $$n\equiv 1 (mod\, 2)$$, where $$\textbf{m}(2,3,1)$$ is a point in the magic hypercube $$M^3_3$$.

formula (4)

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

gives:

$$\textbf{m}(2,3,1) = \sum_{k=0}^{3-1}(m_k(2,3,1)3^k) + 1$$

$$ = \sum_{k=0}^{2}(m_k(2,3,1)3^k) + 1$$

$$ = (m_0(2,3,1)3^0) + (m_1(2,3,1)3^1) + (m_2(2,3,1)3^2) + 1$$

$$ = (m_0(2,3,1)1) + (m_1(2,3,1)3) + (m_2(2,3,1)9) + 1$$

Filling in formula (5) $$m_k(i_1,...,i_p) = ( \sum_{x=1}^{k}((-1)^{x-1}i_x) + (-1)^k \sum_{x=k+1}^{p}(i_x) + C_k)(mod \, n)$$

gives:

$$ = ((( \sum_{x=1}^{0}((-1)^{x-1}i_x) + (-1)^0 \sum_{x=0+1}^{3}(i_x) + C_0)(mod \, 3)) + ((( \sum_{x=1}^{1}((-1)^{x-1}i_x) + (-1)^1 \sum_{x=1+1}^{3}(i_x) + C_1)(mod \, 3)3) + ((( \sum_{x=1}^{2}((-1)^{x-1}i_x) + (-1)^2 \sum_{x=2+1}^{3}(i_x) + C_2)(mod \, 3)9) + 1$$

$$ = (((0 + 1 \sum_{x=1}^{3}(i_x) + C_0)(mod \, 3)) + ((( \sum_{x=1}^{1}((-1)^{x-1}i_x) + -1 \sum_{x=2}^{3}(i_x) + C_1)(mod \, 3)3) + ((( \sum_{x=1}^{2}((-1)^{x-1}i_x) + 1 \sum_{x=3}^{3}(i_x) + C_2)(mod \, 3)9) + 1$$

$$ = ((1 (2 + 3+1) + C_0)(mod \, 3)) + ((((-1)^{1-1}2) + -1 (3+1) + C_1)(mod \, 3)3) + ((((-1)^{1-1}2) + ((-1)^{2-1}3) + 1* 1+ C_2)(mod \, 3)9) + 1$$

$$ = ((6+ C_0)(mod \, 3)) + ((((-1)^{0}2) + -4 + C_1)(mod \, 3)3) + ((((-1)^{0}2) + ((-1)^{1}3) + 1+ C_2)(mod \, 3)9) + 1$$

$$ = ((6+ C_0)(mod \, 3)) + ((2 -4 + C_1)(mod \, 3)3) + ((2 -3 + 1+ C_2)(mod \, 3)9) + 1$$

$$ = ((6+ C_0)(mod \, 3)) + ((-2 + C_1)(mod \, 3)3) + ((0 + C_2)(mod \, 3)9) + 1$$

Filling in formula (6) $$C_k = (-1)^{k+1}(p-k-(k+1)(mod \, 2))\frac{n+1}{2}-1$$ gives:

$$ = ((6+(-1)^{0+1}(3-0-(0+1)(mod \, 2))\frac{3+1}{2}-1)(mod \, 3)) + ((-2 + (-1)^{1+1}(3-1-(1+1)(mod \, 2))\frac{3+1}{2}-1)(mod \, 3)3) + (((-1)^{1+1}(3-2-(2+1)(mod \, 2))\frac{3+1}{2}-1)(mod \, 3)9) + 1$$

$$ = ((6+(-1)^{1}(3-(1)(mod \, 2))\frac{4}{2}-1)(mod \, 3)) + ((-2 + (-1)^{2}(2-(2)(mod \, 2))\frac{4}{2}-1)(mod \, 3)3) + (((-1)^{2}(1-(3)(mod \, 2))\frac{4}{2}-1)(mod \, 3)9) + 1$$

$$ = ((6-1(3-1)2-1)(mod \, 3)) + ((-2 + 1(2)2-1)(mod \, 3)3) + ((1(1-1)2-1)(mod \, 3)9) + 1$$

$$ = ((6-1(2)2-1)(mod \, 3)) + ((-2 + 1(2)2-1)(mod \, 3)3) + (((0)2-1)(mod \, 3)9) + 1$$

$$ = ((6-4-1)(mod \, 3)) + ((-2 + 4-1)(mod \, 3)3) + ((0-1)(mod \, 3)9) + 1$$

$$ = ((1)(mod \, 3)) + ((1)(mod \, 3)3) + ((-1)(mod \, 3)9) + 1$$

$$ = (1) + ((1)3) + ((2)9) + 1$$

$$ = 1 + 3 + 18+ 1 = 23$$

Therefore,

$$\textbf{m}(2,4,6)= 108 + \textbf{m}(2,3,1)$$

$$ =108 + 23 = 131$$

Thus in the magic hypercube $$M^p_n$$ the point $$\textbf{m}(2,4,6)=131$$ when using this formula.

Proof of the formula

To prove that the $$n\equiv 2 (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 proof requirement 1 it has to be shown that the results of the formula are within the interval $$\{1,...,n^p\}$$. This can be done by calculating the minimum and maximum result of formula (7). As shown in the explanation of the formula of $$n\equiv 2 (mod\, 4)$$ the maximum value of $$i^*_x = n/2$$ and the minimal value is $$i^*_x = 1$$, which gives the set of values $$\{1,...,n/2\}$$ that $$'i*_x$$ can be equal to. In the explanation of the formula it was also stated that $$m = n/2$$. So $$\{1,...,n/2\} = \{1,...,m\}$$. So in formula (7)

$$\textbf{m}(i_1,...,i_p) = \textbf{m}_{(k)}(i^*_1,...,i^*_p)$$

$$|\textbf{m}_{(k)}(i^*_1,...,i^*_p):1\leq i^*_1,...,i^*_p\leq m|$$. Which also means that in formula (9)

$$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

$$|\textbf{m}_{(k)}(i_1,...,i_p):1\leq i_1,...,i_p\leq m|$$

and thus in formula (9)

$$|\textbf{v}_{(k)}(i_1,...,i_p):1\leq i_1,...,i_p\leq m|$$

$$|\textbf{m}(i_1,...,i_p):1\leq i_1,...,i_p\leq m|$$

The point $$\textbf{m}(i_1,...,i_p)$$ in formula (9) is a point in the magic hypercube $$M^p_m$$. Which formula to use depends on the value of m, which is related to the value of m. From the fact that $$n\equiv 2 (mod\, 4)$$ the following can be derived.

$$n\equiv 2 (mod\, 4)$$

$$n(mod \, 4) = 2$$

Because $$m = n/2$$, $$2m = n$$. Filling this in gives:

$$2m(mod \, 4) = 2$$

The definition $$x(mod \, y) = x - y\Big \lfloor \frac{x}{y}\Big \rfloor$$ results in

$$2m - 4\Big \lfloor \frac{2m}{4}\Big \rfloor = 2$$

$$m - 2\Big \lfloor \frac{m}{2}\Big \rfloor = 1$$

Implementing $$x(mod \, y) = x - y\Big \lfloor \frac{x}{y}\Big \rfloor$$ the other way around gives:

$$m - 2\Big \lfloor \frac{m}{2}\Big \rfloor = 1$$

$$m\equiv 1 (mod\, 2)$$

Which means that to calculate m, the formula shown in the chapter for $$n\equiv 1 (mod\, 2)$$ has to be followed. In that chapter it was proven that for the magic hypercube $$M^p_n$$ the interval for its values is between $$\{1,...,n^p\}$$, thus the interval for $$M^p_m$$ will be $$\{1,...,m^p\}$$. In $$\{1,...,m^p\}$$ the minimum is 1 and the maximum $$m^p$$.

The other part of formula (9) is $$\textbf{v}_{(k)}(i_1,...,i_p)$$. Formula (10) states that:

$$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$

So to calculate the maximum and minimum of $$ \textbf{v}_{(k)}(i_1,...,i_p)$$, the maximum and minimum of each column of $$\textbf{d}(q,k)$$ has to be calculated. To do so, the interval of k has to be calculated first. k is calculated with formula (8)

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

Where $$1 \leq i_x \leq n$$, thus $$1 \leq i_x \leq 2m$$. The value of k depends on the result of the part

$$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ of formula (8). To show that $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ is either 0 or 1, the following proof exists.

$$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor \geq 1 \, when$$

$$i_x-1 \geq m$$

$$i_x \geq m+1$$

and

$$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor \geq 2 \, when$$

$$i_x-1 \geq 2m$$

$$i_x \geq 2m+1$$

Because according to its definition the maximum value of $$i_x$$ is $$2m$$, the maximum result of $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 1$$ since $$2m \geq 2m +1$$ is not true and $$2m \geq m $$ is true.

In the same fashion the following holds true:

$$\Big \lfloor \frac{i_j-1}{m} \Big \rfloor \leq 0 \, when$$

$$i_x-1 < m$$

$$i_x < m+1$$

and

$$\Big \lfloor \frac{i_j-1}{m} \Big \rfloor \leq -1 \, when$$

$$i_x-1 < 0$$

$$i_x < 1$$

Because the minimal value of $$i_x = 1$$,$$i_x < m+1$$ is possible $$i_x < 1$$ is not, therefore the minimum value of $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 0$$. So if $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 0$$ for every $$i_x$$ when calculating k with formula (8), then the value of k is:

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

$$k = \sum_{x=1}^{p}(0*2^{x-1}) + 1$$

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

$$k = 1$$

And if $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 1$$ for every $$i_x$$ when calculating k, then the value of k is:

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

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

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

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

$$k = 2^p$$

k can be any integer from the interval $$\{1,...,2^p\}$$ because formula (8) basically works the same as a binary number. As shown before, the result of $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ is either 1 or 0, just like in the binary representation of a number every digit is either a 1 or a 0. The $$2^{x-1}$$ part increases per next coordinate by 2, just like how in a binary representation of a number two following digits differ by a factor of 2. Filling in values for x gives

$$ x=1$$ : $$2^{1-1} = 2^0 = 1$$

$$x = 2 $$ : $$2^{2-1} = 2^1 = 2$$

$$x = 3$$ : $$2^{3-1} = 2^2 = 4$$

etc.

just like how the last digit of a binary representation of a number is either 0 or 1, the second 0 or 2, the third 0 or 4 etcetera. With the binary method each integer can be represented and thus k can be each integer in the interval $$\{1,...,2^p\}$$.

And, therefore, in $$\textbf{d}(q,k)$$, k can be any integer within $$\{1,...,2^p\}$$.

To show the maximum $$\textbf{d}(q,k)$$ the maximum value of the formulas (11), (12), (13), (14) and (15) will have to be calculated.

Formula (11):

$$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

In formula (11) the part $$2^{p-1}$$ is not affected by the change of x. The only parts that change are $$2^{x(mod \, 2)}$$ and $$-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$. $$2^{x(mod \, 2)}$$ is either 2 or 1. If x is odd, then $$x(mod \, 2) = 1$$ and if x is even $$x(mod \, 2) = 0$$. Thus the highest result from formula (11) will be with an odd x and the lowest with an even x. The higher x gets, the bigger the result from $$-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$ will be, therefore, more will be subtracted which will lower the result. With the lowest x the least will be subtracted and the higher x gets, the more will be subtracted. This means that for the minimum the highest even value of x will be filled in and for the maximum the lowest odd value of x will be filled in. The interval $$\{1,...,2^p\}$$ gives that the lowest odd value for x is 1, which gives

$$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

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

$$= 2^{p-1}*2^{1}-\Big \lfloor \frac{2}{2} \Big \rfloor$$

$$= 2^{p-1}*2-1$$

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

and the highest even number in the interval $$\{1,...,2^p\}$$ is $$2^p$$, which gives

$$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

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

$$= 2^{p-1}*2^{0}-\Big \lfloor 2^{p-1} + \frac{1}{2} \Big \rfloor$$

$$= 2^{p-1}*1-2^{p-1}$$

$$= 2^{p-1}-2^{p-1} = 0$$

Thus the minimum of formula (11) is 0 and the maximum $$2^p-1$$

Formula (12):

$$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

Just like with formula (11), formula (12) has the constant of $$2^{p-1}$$. Another parallel with formula (11) is that when x increases $$-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$ becomes bigger and decreases the result of formula (12), thus a bigger x slowly results in a smaller value. The only difference between formula (11) and (12) is the part $$2^{x(mod \, 2)}$$ of formula (11) and $$2^{(x+1)(mod \, 2)}$$ of formula (12). Unlike with formula (11), now an even x results in $$(x+1)(mod \, 2)=1$$ and an odd x in $$(x+1)(mod \, 2)=0$$. Which means that in formula (12) the minimum is the highest odd value of x and the maximum the smallest even x value. Again x is any integer from the interval $$\{1,...,2^p\}$$. The smallest even value from this interval is $$ x = 2$$ which gives:

$$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

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

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

$$= 2^{p-1}*2^{1}-\Big \lfloor 1 + \frac{1}{2} \Big \rfloor$$

$$= 2^{p-1}*2^{1}-1$$

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

And the biggest odd value from the interval $$\{1,...,2^p\}$$ is $$x = 2^p-1$$ which gives:

$$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

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

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

$$= 2^{p-1}*2^{0}-\Big \lfloor 2^{p-1}\Big \rfloor$$

$$= 2^{p-1}*1-2^{p-1}$$

$$= 2^{p-1}-2^{p-1} = 0$$

Which means that the minimum of formula (12) is 0 and the maximum $$2^p-1$$.

Formula (13):

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

Where $$x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} -1 \Big \rfloor)$$ is a formula for calculating the amount of 1’s in the binary representation of $$i_x-1$$. If there is an odd number of ones in the formula then $$(x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2)$$ results in 0 and if there is an even number of ones then the result is 1. The $$(x+1)(mod \, 2)$$ part of the formula is equal to 1 if x is even and equal to 0 if x is odd. The higher x get the bigger the result of formula (13) will eventually become, as $$(x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2)$$ only possibly adds 1 and $$(x+1)(mod \, 2)$$ only can subtract 1 from the total. Thus one of the lowest values of x will result in the minimum of formula (13) and one of the highest values of x will result in the maximum. So to get the minimum of formula (13) the values x = 1 and x = 2 will be filled in. The number that has to be represented in binary when x = 1 is 0, as 1 - 1 = 0 and when x = 2 the number that is represented in binary is 1. The binary representation of 0 : 0 and the binary representation of 1 : 1. x = 1 gives:

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,1) = (1 - \sum_{k=1}^{log(1,2)+1}(\Big \lfloor \frac{1-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 1 - (1+1)(mod \,2)$$

$$= (1 - \sum_{k=1}^{1}(\Big \lfloor \frac{0}{2^k} \Big \rfloor)-1)(mod \,2) - (2)(mod \,2)$$

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

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

$$= (1 - 0 -1)(mod \,2)$$

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

x = 2 gives:

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,2) = (2 - \sum_{k=1}^{log(2,2)+1}(\Big \lfloor \frac{2-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 2 - (2+1)(mod \,2)$$

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

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

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

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

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

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

Filling in x = 3 and upwards to check if they are the minimum is unnecessary, because the two possible subtractions, which are -1 and $$-(x+1)(mod \, 2)$$, will together never subtract more than 2, meaning that 3-2 =1, which is still bigger than the 0 found for $$ x = 10$$.

The maximum of formula (13) depends on whether $$2^p - 1$$ has an even or odd amount of 1’s in its binary representation. If it is an odd amount, then filling in $$x = 2^p$$ gives:

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,2^p) = (2^p - \sum_{k=1}^{log(2^p,2)+1}(\Big \lfloor \frac{2^p-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 2^p - (2^p+1)(mod \,2)$$

because there is an odd amount of 1’s in $$2^p - 1$$ $$(x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) = 1$$, which gives:

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

And if $$2^p - 1$$ has an even amount of 1’s then $$2^p - 2$$ has an even amount of 1’s:

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,2^p-1) = (2^p - 1 - \sum_{k=1}^{log(2^p-1,2)+1}(\Big \lfloor \frac{2^p-1-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 2^p-1 - (2^p-1+1)(mod \,2)$$

$$\textbf{d}(3,2^p-1) = (2^p - \sum_{k=1}^{log(2^p-1,2)-2}(\Big \lfloor \frac{2^p-2}{2^k} \Big \rfloor)-2)(mod \,2) - 1 + 2^p-1 - (2^p)(mod \,2)$$

Because there is an even amount of 1’s in $$2^p - 2$$ $$(2^p - \sum_{k=1}^{log(2^p-1,2)-2}(\Big \lfloor \frac{2^p-2}{2^k} \Big \rfloor)-2)(mod \,2) - 1 + 2^p-1 - (2^p)(mod \,2) = 0$$, which gives:

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

A lower x would only result in a lower result of formula (13), as the maximum value of $$x = 2^p-2$$ would only have an addition of 1 from $$(2^p)(mod \,2)$$, which would result in $$\textbf{d}(3,2^p-2) = 2^p-2$$ due to the subtraction of 1 in the formula.

If $$2^p - 1$$ has an even number of 1’s then

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,2^p) = (2^p - \sum_{k=1}^{log(2^p,2)+1}(\Big \lfloor \frac{2^p-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 2^p - (2^p+1)(mod \,2)$$

because there is an even amount of 1’s in $$2^p - 1$$ $$(x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) = 0$$

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

and

$$\textbf{d}(3,x) = (x - \sum_{k=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

$$\textbf{d}(3,2^p-1) = (2^p - 1 - \sum_{k=1}^{log(2^p-1,2)+1}(\Big \lfloor \frac{2^p-1-1}{2^k} \Big \rfloor)-1)(mod \,2) - 1 + 2^p-1 - (2^p-1+1)(mod \,2)$$

$$\textbf{d}(3,2^p-1) = (2^p - \sum_{k=1}^{log(2^p-1,2)-2}(\Big \lfloor \frac{2^p-2}{2^k} \Big \rfloor)-2)(mod \,2) - 1 + 2^p-1 - (2^p)(mod \,2)$$

because there is an odd amount of 1’s in $$2^p - 2$$, $$(2^p - \sum_{k=1}^{log(2^p-1,2)-2}(\Big \lfloor \frac{2^p-2}{2^k} \Big \rfloor)-2)(mod \,2) - 1 + 2^p-1 - (2^p)(mod \,2) = 1$$ which gives:

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

The same goes here for filling in a lower value for x. This means that the minimum value of formula (13) is 0 and the maximum $$2^p -1$$.

Formula (14):

$$\textbf{d}(j,x) = x-1, \, j=4,6,8,10,...,m-1$$

It is easy to see here that the lowest x will result in the lowest value of formula (14) and the highest value of x in the highest result for formula (14). This is because only -1 is subtracted from x. In the interval $$\{1,...,2^p\}$$ , 1 is the lowest value and $$2^p$$ the highest, therefore, the minimum is:

$$\textbf{d}(j,x) = x-1, \, j=4,6,8,10,...,m-1$$

$$\textbf{d}(j,1) = 1-1 = 0 $$

and the maximum

$$\textbf{d}(j,x) = x-1, \, j=4,6,8,10,...,m-1$$

$$\textbf{d}(j,2^p) = 2^p-1 $$

Formula (15):

$$\textbf{d}(j,x) = 2^p-x, \, j=5,7,9,11,...,m$$

This formula is just like formula (14) but just the other way around. This time the lowest value of x will cause the highest result of formula (15) and the highest value of x the lowest result. This is because the value of x is subtracted in this formula, so the higher value of x the more will be subtracted. So again in the interval $$\{1,...,2^p\}$$ , 1 is the lowest value and $$2^p$$ the highest. Therefore, the minimum is:

$$\textbf{d}(j,x) = 2^p-x, \, j=5,7,9,11,...,m$$

$$\textbf{d}(j,2^p) = 2^p-2^p = 0$$

and the maximum:

$$\textbf{d}(j,x) = 2^p-x, \, j=5,7,9,11,...,m$$

$$\textbf{d}(j,1) = 2^p-1$$

Therefore, all formulas from (11) to (15) have a minimum of 0 and a maximum of $$2^p-1$$. This means that the minimum of $$\textbf{v}_{(k)}(i_1,...,i_p)$$ is 0 and the maximum $$2^p-1$$. Filling in both the minimum of $$\textbf{v}_{(k)}(i_1,...,i_p)$$, which is 0, and $$\textbf{m}(i_1,...,i_p)$$, which is 1, in formula (9) gives:

$$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

$$= 0*m^p + 1 = 1$$

And filling in the maxima gives of $$\textbf{v}_{(k)}(i_1,...,i_p)$$, which is 2^p-1 and $$\textbf{m}(i_1,...,i_p)$$, which is $$m^p$$, gives:

$$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

$$= (2^p-1)*m^p + m^p$$

Filling in $$ m = \frac{n}{2}$$ gives

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

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

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

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

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

$$= n^p$$

Thus the minimum of $$\textbf{m}_{(k)}(i_1,...,i_p)$$ and consequently $$\textbf{m}(i_1,...,i_p)$$ from formula (8) is 1 and the maximum is $$n^p$$. Formulas (11) through (15) also do not contain any divisions, fractions or decimal numbers outside of integrals and all values for x are integers, meaning that all results of these formulas will be an integer. Which means that all values of formula (8) are in the interval $$\{1,...,n^p\}$$ which completes the proof for requirement 1.

Proof For Requirement 2

To complete requirement 2 it has to be proven that no 2 points within $$M^p_n$$ with different coordinates have the same value when creating the magic hypercube $$M^p_n$$ with the $$n\equiv 2 (mod\, 4)$$ formula. To show this it is first important to look at formula (9)

$$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

As shown in the proof of requirement 1, the interval for the results of $$ \textbf{m}(i_1,...,i_p)$$, which describes a point within the magic hypercube $$M^p_m$$, is $$\{1,...,m^p\}$$. It was also demonstrated in the proof of requirement 1 that $$\textbf{v}_{(k)}(i_1,...,i_p)$$ can be any number in the interval $$\{0,...,2^p-1\}$$. This means that $$\textbf{v}_{(k)}(i_1,...,i_p)m^p$$ is any number from the set $$\{0,m^p,2*m^p,...,(2^p-2)*m^p,(2^p-1)*m^p\}$$. In the proof of requirement 2 of the $$n\equiv 1 (mod\, 2)$$ formula it was also shown that no two points with different coordinates result in the same value.

To show that no 2 points with different coordinates can equal the same value, it will be shown what would have to happen if two points $$\textbf{m}_{(k)}(i_1,...,i_p)$$ and $$\textbf{m}_{(k)}(i'_1,...,i'_p)$$ would equal each other.

$$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{m}_{(k)}(i'_1,...,i'_p)$$

filling in formula (9) gives

$$\textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p) = \textbf{v}_{(k)}(i'_1,...,i'_p)m^p + \textbf{m}(i'_1,...,i'_p)$$

$$\textbf{v}_{(k)}(i_1,...,i_p)m^p - \textbf{v}_{(k)}(i'_1,...,i'_p)m^p + \textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) = 0$$

$$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p + \textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) = 0$$

The proof of requirement 2 of formula $$n\equiv 1 (mod\, 2)$$ showed that no two different points have the same value. What this means is that $$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) \neq 0$$, as $$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p)$$. As the values of both $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ can be any value from the interval $$\{1,...,m^p\}$$, the possible results of $$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p)$$ can be calculated. The minimal value that can result from the subtraction is when $$\textbf{m}(i_1,...,i_p)$$ is the lowest value possible and $$\textbf{m}(i'_1,...,i'_p)$$ is the highest value possible. The interval $$\{1,...,m^p\}$$ gives $$\textbf{m}(i_1,...,i_p)=1$$ and $$\textbf{m}(i'_1,...,i'_p) = m^p$$ to adhere to these requirements. This subtraction of these points gives:

$$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) = 1-m^p$$

And to get the maximum value of the subtraction $$\textbf{m}(i_1,...,i_p)$$ needs to be the biggest value possible and $$\textbf{m}(i'_1,...,i'_p)$$ needs to be the lowest value possible, which means that $$\textbf{m}(i_1,...,i_p)=m^p$$ and $$\textbf{m}(i'_1,...,i'_p) = 1$$ when staying in the bound of the interval $$\{1,...,m^p\}$$. This gives the subtraction:

$$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) = m^p-1$$

Whenever the value of $$\textbf{m}(i_1,...,i_p)$$ increases by one the result of the subtraction increases by one and whenever $$\textbf{m}(i'_1,...,i'_p)$$ increases by one the result of the subtraction decreases by one. This means that the result of the subtraction can equal any value from the set $$\{1-m^p,2-m^p,...,-1,1,...,m^p-2,m^p-1\}$$, skipping the value 0 as that would only occur when $$\textbf{m}(i_1,...,i_p) = \textbf{m}(i'_1,...,i'_p)$$. The relation between $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ and $$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p)$$ has to be as follows:

$$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p + \textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p) = 0$$

$$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p = -(\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p))$$

What this means is that the result of the $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ has to be the result of $$\textbf{m}(i_1,...,i_p)-\textbf{m}(i'_1,...,i'_p)$$ but negative. So the results of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ have to be calculated. Since both $$\textbf{v}_{(k)}(i_1,...,i_p)$$ and $$\textbf{v}_{(k)}(i'_1,...,i'_p)$$ can be any number from the interval $$\{0,...,2^p-1\}$$, the result of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ is at its minimum when $$\textbf{v}_{(k)}(i_1,...,i_p) = 0$$, which is the minimal value of the interval, and $$\textbf{v}_{(k)}(i_1,...,i_p) = 2^p-1$$, which is the maximal value of the interval. The result of these values is:

$$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p = (0-(2^p-1))m^p = (-2^p+1)m^p$$

and the maximal result of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ is when $$\textbf{v}_{(k)}(i_1,...,i_p) = 2^p-1$$,which is the maximal value of the interval, and $$\textbf{v}_{(k)}(i_1,...,i_p) = 0$$,which is the minimal value of the interval. The result of these values is:

$$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p = (2^p-1-0)m^p = (2^p-1)m^p$$

Increasing the value of $$\textbf{v}_{(k)}(i_1,...,i_p)$$ means that the result of the subtraction increases by 1 and, therefore, the result of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ increases by $$m^p$$. Increasing the value of $$\textbf{v}_{(k)}(i'_1,...,i'_p)$$ means that the result of the subtraction decreases by 1 and, therefore, the result of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ decreases by $$m^p$$. This means that the results of $$(\textbf{v}_{(k)}(i_1,...,i_p) - \textbf{v}_{(k)}(i'_1,...,i'_p))m^p$$ can be any number of the set $$\{(-2^p+1)m^p,(-2^p+2)m^p,...,-m^p,0,m^p,...,(2^p-2)m^p,(2^p-1)m^p\}$$. As there is no value in the set $$\{(-2^p+1)m^p,(-2^p+2)m^p,...,-m^p,0,m^p,...,(2^p-2)m^p,(2^p-1)m^p\}$$ that has a negative counterpart in the set $$\{1-m^p,2-m^p,...,-1,1,...,m^p-2,m^p-1\}$$, it is impossible that $$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{m}_{(k)}(i'_1,...,i'_p)$$ when $$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p)$$.

To further prove that no two points in the magic hypercube $$M^p_n$$ have the same value when using the $$n\equiv 2 (mod\, 4)$$, it has to be proven that in formula (7)

when

$$\textbf{m}(i_1,...,i_p) = \textbf{m}_{(k)}(i^*_1,...,i^*_p)$$

The following is true:

$$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p)$$

It was previously shown that when the coordinates

$$(i^*_1,...,i^*_p) \neq (i'^*_1,...,i'^*_p)$$

the results of formula (7) have the relationship

$$\textbf{m}_{(k)}(i_1,...,i_p) \neq \textbf{m}_{(k)}(i'_1,...,i'_p)$$

and thus

$$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p)$$

.

So now it has to be proven that

$$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p)$$

When $$(i^*_1,...,i^*_p) = (i'^*_1,...,i'^*_p)$$ and $$(i_1,...,i_p) \neq (i'_1,...,i'_p)$$

So to show this, 2 different points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ in the magic hypercube $$M^p_n$$ will be taken with the relationship $$(i^*_1,...,i^*_p) = (i'^*_1,...,i'^*_p)$$. For these points to have the same value the result of formula (7) needs to be the same, which gives:

$$\textbf{m}(i_1,...,i_p) =\textbf{m}(i'_1,...,i'_p)$$

$$\textbf{m}_{(k)}(i^*_1,...,i^*_p) =\textbf{m}_{(j)}(i'^*_1,...,i'^*_p)$$

Since the coordinates have the relationship $$(i^*_1,...,i^*_p) = (i'^*_1,...,i'^*_p)$$ the following is also true:

$$\textbf{m}_{(k)}(i^*_1,...,i^*_p) =\textbf{m}_{(j)}(i^*_1,...,i^*_p)$$

Both the values of k and j are calculated with formula (8). j is purely used to show that its value can differ from that of k in $$\textbf{m}_{(k)}(i^*_1,...,i^*_p)$$. The calculation for k is:

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

and the calculation for j is:

$$j = \sum_{x=1}^{p}(\Big \lfloor \frac{i'_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

Filling in formula (9) in $$\textbf{m}_{(k)}(i^*_1,...,i^*_p) =\textbf{m}_{(j)}(i^*_1,...,i^*_p)$$gives:

$$\textbf{m}_{(k)}(i^*_1,...,i^*_p) =\textbf{m}_{(j)}(i^*_1,...,i^*_p)$$

$$\textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p) = \textbf{v}_{(j)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$

$$\textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p) - \textbf{m}(i_1,...,i_p) = \textbf{v}_{(j)}(i_1,...,i_p)m^p$$

$$\textbf{v}_{(k)}(i_1,...,i_p)m^p = \textbf{v}_{(j)}(i_1,...,i_p)m^p$$

$$\textbf{v}_{(k)}(i_1,...,i_p) = \textbf{v}_{(j)}(i_1,...,i_p)$$

The result value of $$\textbf{v}_{(k)}(i_1,...,i_p)$$ and $$\textbf{v}_{(j)}(i_1,...,i_p)$$ is calculated with formula (10):

$$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$

and

$$ \textbf{v}_{(j)}(i_1,...,i_p) = \textbf{d}(q,j)$$

The calculation of q in $$\textbf{d}(q,k)$$ and $$\textbf{d}(q,j)$$ is done with formula (16)

$$q = \textbf{u}(i_1,...,i_p) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1$$

Since the coordinates $$(i_1,...,i_p) = (i_1,...,i_p)$$ in $$\textbf{v}_{(k)}(i_1,...,i_p)$$ and $$ \textbf{v}_{(j)}(i_1,...,i_p)$$, the points in the calculation of q will be the same and, therefore, in both

$$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$ and $$ \textbf{v}_{(j)}(i_1,...,i_p) = \textbf{d}(q,j)$$

the q’s are equal.

The calculation of k and j as stated before follow formula (8)

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

and

$$j = \sum_{x=1}^{p}(\Big \lfloor \frac{i'_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

As shown in the proof of requirement 1 of the $$n\equiv 2 (mod\, 4)$$ formula, $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 0$$ when $$i_x < m+1$$ and $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 1$$ when $$i_x \geq m+1$$. For both $$(i_1,...,i_p) \neq (i'_1,...,i'_p)$$ and $$(i^*_1,...,i^*_p) = ((i'_1)^*,...,(i'_p)^*)$$ to be true, both points need to have the following relationship for at least one coordinate: $$i_l \neq i'_l$$ and $$i^*_l = (i'_l)^*$$in which l can be any number from the interval $$\{1,...,p\}$$. For $$i^*_l = (i'_l)^{*}$$ and $$i_l \neq i'_l$$ to be true, the calculation of $$i^*_l = (i'_l)^{*}$$has to go as follows:

$$i^*_l = (i'_ l)^*$$

$$min\{i_l,n+1-i_l\} = min\{i'_l,n+1-i'_l\}$$

When the result of $$i^*_l = min\{i_l,n+1-i_l\} = i_l$$ then $$(i'_l)^* =min\{i'_l,n+1-i'_l\} = n+1-i'_l$$ and when the result of $$i^*_l = min\{i_l,n+1-i_l\} = n+1-i_l$$ then $$(i'_l)^* = min\{i'_l,n+1-i'_l\} = i'_l$$,since $$i_l \neq i'_l$$.

$$i^*_l = min\{i_l,n+1-i_l\} = i_l$$, when

$$i_l < n+1-i_l$$

$$2*i_l < n+1$$

because the value of $$i_l$$ always increases by an interval of 1, the following is true:

$$2*i_l \leq n$$

Filling in $$ n = 2*m$$ gives

$$2*i_l \leq 2*m$$

$$i_l \leq m$$

And again because the value of $$i_l$$ always changes by 1, the following is true:

$$i_l < m+1$$

Thus $$min\{i_l,n+1-i_l\} = i_l$$ when $$i_l < m+1$$. As shown previously $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 0$$ when $$i_x < m+1$$ and because $$min\{i_l,n+1-i_l\} = i_l$$ holds true when $$i_l < m+1$$, filling in the value for coordinate $$i_l$$ in$$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor $$ will always result in 0 when $$i^*_l = min\{i_l,n+1-i_l\} = i_l$$.

The same reasoning applies for $$i^*_l = min\{i_l,n+1-i_l\} = n+1-i_l$$, which hold true when:

$$i_l > n+1-i_l$$

$$2*i_l > n+1$$

Here again $$i_l$$ always changes by 1 and thus

$$2*i_l \geq n+2$$

Filling in $$ n = 2*m$$ gives

$$2*i_l \geq 2*m+2$$

$$i_l \geq m+1$$

Thus $$i^*_l = min\{i_l,n+1-i_l\} = n+1-i_l$$ when $$i_l \geq m+1$$. As shown previously $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 1$$ when $$i_l \geq m+1$$and because $$i^*_l = min\{i_l,n+1-i_l\} = n+1-i_l$$ holds true when $$i_l \geq m+1$$, filling in the value for coordinate $$i_l$$ in$$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor $$ will always result in 1 when $$min\{i_l,n+1-i_l\} = n+1-i_l$$.

These same proofs work for $$i'_l$$ and thus when $$i^*_l = min\{i_l,n+1-i_l\} = i_l$$ and $$(i'_l)^* =min\{i'_l,n+1-i'_l\} = n+1-i'_l$$, the difference between the value of j and k,when the rest of the coordinates have the same value in $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$, is:

$$j-k$$

$$=\sum_{x=1}^{p}(\Big \lfloor \frac{i'_x-1}{m}\Big \rfloor*2^{x-1}) + 1-(\sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1)$$

$$=\sum_{x=1}^{p}(\Big \lfloor \frac{i'_x-1}{m}\Big \rfloor*2^{x-1}) + 1-\sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) - 1$$

$$=\sum_{x=1}^{p}((\Big \lfloor \frac{i'_x-1}{m}\Big \rfloor-\Big \lfloor \frac{i_x-1}{m}\Big \rfloor)*2^{x-1})$$

As all coordinates of the points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ are equal except for $$i_l$$ and $$i'_l$$ the following is true:

$$(1-0)*2^{l-1} = 2^{l-1}$$

And if $$min\{i_l,n+1-i_l\} = n+1-i_l$$ and $$min\{i'_l,n+1-i'_l\} = i'_l$$ and all the coordinates in $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ are equal except $$i_l$$ and $$i'_l$$ then:

$$(0-1)*2^{l-1} = -2^{l-1}$$

This means that for every coordinate $$i_l$$ and $$i'_l$$ which have the relationship $$i_l \neq i'_l$$ and $$i^*_l = (i'_l)^*$$ the difference between the results of formula (8) when calculating k and j will be either + or - $$2^{l-1}$$. There however may be multiple coordinates with the relationship $$i_l \neq i'_l$$ and $$i^*_l = (i'_l)^*$$ with $$l$$ taking different values. However as mentioned in the proof of requirement 1 for this formula, formula (8) creates a sort of binary number in which each value for x inf formula (8) gets its own digit. It is impossible to represent the same value in 2 different ways in binary representation and thus having multiple coordinates with the relationship $$i_l \neq i'_l$$ and $$i^*_l = (i'_l)^*$$will also create new j and k values. Therefore, when the coordinates of 2 points have the relationship $$(i^*_1,...,i^*_p) = ((i'_1)^*,...,(i'_p)^*)$$ and $$(i_1,...,i_p) \neq (i'_1,...,i'_p)$$, the result of formula (8) will differ for the points.

So for

$$\textbf{v}_{(k)}(i_1,...,i_p) = \textbf{v}_{(j)}(i_1,...,i_p)$$

k and j are different. And thus

$$\textbf{d}(q,k) = \textbf{d}(q,j)$$

Where $$q = q$$ and $$k \neq j$$

Because q is the same for both $$\textbf{d}(q,k)$$ and $$\textbf{d}(q,j)$$, as proven previously, the calculation of both $$\textbf{d}(q,k)$$ and $$\textbf{d}(q,j)$$ follow the same formula, which is either formula (11),(12),(13),(14) or (15). So, to prove that it is impossible to have two points with the same value, it has to be proven that for formulas (11-15) j and k need to have the same value for the same result.

Formula (11):

$$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

Filling in $$x= j$$ and $$x =k$$ with $$q = 1$$ in $$\textbf{d}(q,k) = \textbf{d}(q,j)$$, gives

$$\textbf{d}(1,k) = \textbf{d}(1,j)$$

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

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

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

As the values of $$2^{k(mod \, 2)}$$ and $$2^{j(mod \, 2)}$$ can both be either 1 or 2 depending on whether j and k are even or odd, the result of the subtraction $$2^{k(mod \, 2)}-2^{j(mod \, 2)}$$ can be the following:

$$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 2^{0}-2^{0} = 1-1 = 0$$, when k is even and j is even

$$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 2^{1}-2^{1} = 2-2 = 0$$, when k is odd and j is odd

$$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 2^{0}-2^{1} = 1-2 = -1$$, when k is even and j is odd

$$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 2^{1}-2^{0} = 2-1 = 1$$, when k is odd and j is even

Filling in $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 0$$, which occurs when k and j have the same parity, in $$(2^{k(mod \, 2)}-2^{j(mod \, 2)})*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ gives:

$$(0)*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$0=-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$\Big \lfloor \frac{j+1}{2} \Big \rfloor= \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

So the results from $$\Big \lfloor \frac{j+1}{2} \Big \rfloor$$ and $$\Big \lfloor \frac{k+1}{2} \Big \rfloor$$ need to be the same. $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 0$$ is only true when j and k have the same parity. Since j and k cannot be the same and need to have the same parity their difference needs to be at least 2. However adding or subtracting 2 from either j or k means that the result from $$\Big \lfloor \frac{j+1}{2} \Big \rfloor$$ and $$\Big \lfloor \frac{k+1}{2} \Big \rfloor$$ will differ by 1. For instance if $$k = j +2$$, then:

$$\Big \lfloor \frac{j+1}{2} \Big \rfloor= \Big \lfloor \frac{j+2+1}{2} \Big \rfloor$$

$$\Big \lfloor \frac{j+1}{2} \Big \rfloor= \Big \lfloor \frac{j+1}{2} +1 \Big \rfloor$$

Therefore, when $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 0$$ and to keep $$(2^{k(mod \, 2)}-2^{j(mod \, 2)})*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ j and k need to be the same.

If $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$, then k has to be odd and j has to be even. Filling in $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$ in $$(2^{k(mod \, 2)}-2^{j(mod \, 2)})*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ gives:

$$(1)*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

Filling in the highest value from the interval $$\{1,...,2^p\}$$ for k and the lowest for j which follow the requirement that k is even and j is odd gives: $$k = 2^p$$ and $$j = 1$$. Filling this in gives:

$$2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$2^{p-1} =-\Big \lfloor \frac{1+1}{2} \Big \rfloor + \Big \lfloor \frac{2^p+1}{2} \Big \rfloor$$

$$2^{p-1} =-\Big \lfloor \frac{2}{2} \Big \rfloor + \Big \lfloor 2^{p-1} \frac{1}{2} \Big \rfloor$$

$$2^{p-1} =-\lfloor 1 \rfloor + \Big \lfloor 2^{p-1} \frac{1}{2} \Big \rfloor$$

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

Which is not true. Since a higher value for j and a lower value for k would only decrease the value of the right side of the equation, the result will always stay below $$2^{p-1}$$ and thus when $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$,$$\textbf{d}(1,k) = \textbf{d}(1,j)$$ is impossible when $$ k \neq j$$.

Last of all when $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = -1$$, then k has to be even and j has to be odd. Filling in $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = -1$$in $$(2^{k(mod \, 2)}-2^{j(mod \, 2)})*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ gives:

$$(-1)*2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$-2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

This time filling in the lowest value from the interval from $$\{1,...,2^p\}$$ in for k where k is odd and the highest value for j where j is even. This gives $$k = 1$$ and $$j = 2^p$$. Filling this in gives:

$$-2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$

$$-2^{p-1} =-\Big \lfloor \frac{2^p+1}{2} \Big \rfloor + \Big \lfloor \frac{1+1}{2} \Big \rfloor$$

$$-2^{p-1} =-\Big \lfloor 2^{p-1} + \frac{1}{2} \Big \rfloor + \Big \lfloor \frac{2}{2}\Big \rfloor$$

$$-2^{p-1} =-\Big \lfloor 2^{p-1} + \frac{1}{2}\Big \rfloor + \lfloor 1 \rfloor$$

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

This is also not true. Here again filling in a lower value for j or a higher value for k will only increase the result from the right side of the equation, therefore, it will never be equal to $$-2^{p-1}$$ and thus when $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$,$$\textbf{d}(1,k) = \textbf{d}(1,j)$$ is impossible when $$ k \neq j$$.

This all combined shows that when $$k \neq j$$,$$\textbf{d}(1,k) \neq \textbf{d}(1,j)$$.

Formula (12):

$$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

Filling in $$x= j$$ and $$x =k$$ with $$q = 2$$ in $$\textbf{d}(q,k) = \textbf{d}(q,j)$$, gives

$$\textbf{d}(2,k) = \textbf{d}(2,j)$$

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

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

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

As the values of $$2^{(k+1)(mod \, 2)}$$ and $$2^{(j+1)(mod \, 2)}$$ can both be either 1 or 2, depending on the parity of both k and j, the result of the subtraction $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)}$$ can be the following:

$$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 2^{0}-2^{0} = 1-1 = 0$$, when k is odd and j is odd

$$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 2^{1}-2^{1} = 2-2 = 0$$, when k is even and j is even

$$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 2^{0}-2^{1} = 1-2 = -1$$, when k is odd and j is even

$$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 2^{1}-2^{0} = 2-1 = 1$$, when k is even and j is odd

The proof that $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 0$$ is only possible when $$k = j$$ is exactly the same as for formula (11).

The proof for $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = -1$$ is almost the same as for formula (11) with $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = -1$$. However this time k has to be the maximum odd number from the interval $$\{1,...,2^p\}$$, which gives $$k=2^p-1$$. The value of j is also different, this time having to be the minimum even value from the same interval, which gives $$j=2$$. As mentioned in the proof for formula (11), changing the value of j and k will never make $$-2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ true and thus it is also impossible for formula (12) to get the same result with different values for j and k when $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = -1$$.

Again, the proof for $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 1$$ is nearly identical to that of formula (11), with $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$. But just like with $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = -1$$, the values of j and k are slightly different. This time k has to be the minimum even value and j the maximum odd value from the interval $$\{1,...,2^p\}$$. This gives $$k=2$$ and $$j=2^p-1$$. Again, in the proof of formula (11) it was shown that when $$2^{k(mod \, 2)}-2^{j(mod \, 2)} = 1$$, changing the value of j and k will never make $$2^{p-1} =-\Big \lfloor \frac{j+1}{2} \Big \rfloor + \Big \lfloor \frac{k+1}{2} \Big \rfloor$$ true and thus when $$2^{(k+1)(mod \, 2)}-2^{(j+1)(mod \, 2)} = 1$$, $$\textbf{d}(2,k) = \textbf{d}(2,j)$$ is impossible.

This means that when j and k are different the result from formula (12) will also be different

Formula (13):

$$\textbf{d}(3,x) = (x - \sum_{l=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^l} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

Filling in $$x= j$$ and $$x =k$$ with $$q = 3$$ in $$\textbf{d}(q,k) = \textbf{d}(q,j)$$, gives

$$\textbf{d}(3,k) = \textbf{d}(3,j)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - 1 + k - (k+1)(mod \,2) = (j - \sum_{l=1}^{log(j,2)+1}(\Big \lfloor \frac{j-1}{2^l} \Big \rfloor)-1)(mod \,2) - 1 + j - (j+1)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (j - \sum_{l=1}^{log(j,2)+1}(\Big \lfloor \frac{j-1}{2^l} \Big \rfloor)-1)(mod \,2) + j - (j+1)(mod \,2)$$

Since the result is either 0 or 1 for:$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2),(k+1)(mod \,2)$$, $$(j - \sum_{l=1}^{log(j,2)+1}(\Big \lfloor \frac{j-1}{2^l} \Big \rfloor)-1)(mod \,2)$$,$$(k+1)(mod \,2)$$ and $$(j+1)(mod \,2)$$, the difference of j and k caps out at 2, otherwise there is no way for

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (j - \sum_{l=1}^{log(j,2)+1}(\Big \lfloor \frac{j-1}{2^l} \Big \rfloor)-1)(mod \,2) + j - (j+1)(mod \,2)$$

to be true.

Say the difference between j and k is 1, where j = k+1. Filling this in gives

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (k+1 - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k+1-1}{2^l} \Big \rfloor)-1)(mod \,2) + k+1 - (k+1+1)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) + k+1 - (k+2)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) = 1 - (k)(mod \,2) + (k+1)(mod \,2)$$

When k is odd, then

$$1 - (k)(mod \,2) + (k+1)(mod \,2) = 1 - 1 + 0 = 0$$

So when k is odd

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) =0$$

As stated before, $$k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1$$ calculates the amount of 1’s in the binary representation of $$k-1$$ . Since k is odd, $$k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1$$ calculates the binary representation of an even number, as this calculates for $$k-1$$. In the binary representation of a number the only digit that decides the parity of a given number is the 1 or 0 that represents $$2^0$$. The rest of the digits represent another power of 2, which is always equal to an even number. Adding an even number to an even number always results in an even number and adding an odd number to an even number results in an odd number. So in the binary representation of an even number the last digit will always be a 0 and for an odd number it will always be a 1. Since k is odd and k-1 is even, their binary representation is exactly the same, apart from the fact that the last digit is a 0 for k-1 and a 1 for k. This means that when the amount of 1’s in the binary representation of k-1 is odd then it is even for k and when it is even for k-1 then it is odd for k. This means that $$k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2)$$ and $$ (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) $$ will never be the same and, therefore, $$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) =0$$ is not true when k is odd.

When k is even then

$$1 - (k)(mod \,2) + (k+1)(mod \,2) = 1 - 0 + 1 = 2$$

Since the value of both $$\sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2)$$ and $$ (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) $$ is either 1 or 0 due to the $$(mod \,2) $$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2) =2$$

Will never be true as the maximum of $$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k - \sum_{l=1}^{log(k+1,2)+1}(\Big \lfloor \frac{k}{2^l} \Big \rfloor))(mod \,2)$$ is 1.

Thus when $$j = k+1$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (j - \sum_{l=1}^{log(j,2)+1}(\Big \lfloor \frac{j-1}{2^l} \Big \rfloor)-1)(mod \,2) + j - (j+1)(mod \,2)$$

will always be false.

The other option is $$j = k + 2$$. Filling this in gives:

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) + k - (k+1)(mod \,2) = (k+2 - \sum_{l=1}^{log(k+2,2)+1}(\Big \lfloor \frac{k+2-1}{2^l} \Big \rfloor)-1)(mod \,2) + k+2 - (k+2+1)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) - (k+1)(mod \,2) = (k+2 - \sum_{l=1}^{log(k+2,2)+1}(\Big \lfloor \frac{k+2-1}{2^l} \Big \rfloor)-1)(mod \,2) +2 - (k+3)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) -(k+1 - \sum_{l=1}^{log(k+2,2)+1}(\Big \lfloor \frac{k+1}{2^l} \Big \rfloor))(mod \,2) = 2 - (k+1)(mod \,2) + (k+1)(mod \,2)$$

$$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) -(k+1 - \sum_{l=1}^{log(k+2,2)+1}(\Big \lfloor \frac{k+1}{2^l} \Big \rfloor))(mod \,2) = 2$$

As mentioned when proving that $$j = k+1$$ is impossible, $$(k - \sum_{l=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^l} \Big \rfloor)-1)(mod \,2) -(k+1 - \sum_{l=1}^{log(k+2,2)+1}(\Big \lfloor \frac{k+1}{2^l} \Big \rfloor))(mod \,2)$$ will cap out at 1 and, therefore, will never be equal to 2. Thus $$j = k + 2$$ is also impossible.

The proof for $$k = j + 1$$ is the same as $$k = j + 1$$, but then the j and k are swapped around and the proof of $$k = j + 2$$ is the same as $$j = k + 2$$ again with the j and k swapped.

This proves that $$\textbf{d}(3,k) = \textbf{d}(3,j)$$ is impossible unless $$k = j$$

Formula (14):

$$\textbf{d}(q,x) = x-1, \, q=4,6,8,10,...,m-1$$

Filling in $$x= j$$ and $$x =k$$ with $$q = 4$$ in $$\textbf{d}(q,k) = \textbf{d}(q,j)$$, gives

$$\textbf{d}(4,k) = \textbf{d}(4,j)$$

$$k-1 = j-1$$

$$k = j$$

Thus for $$\textbf{d}(4,k) = \textbf{d}(4,j)$$ to be true, $$k = j$$.

If q is a value in the set $$\{4,6,...,m-3,m-1\}$$ this proof will also be followed as formula (14) will be used then as well.

Formula (15):

$$\textbf{d}(q,x) = 2^p-x, \, q=5,7,9,11,...,m$$

Filling in $$x= j$$ and $$x =k$$ with $$q = 5$$ in $$\textbf{d}(q,k) = \textbf{d}(q,j)$$, gives

$$\textbf{d}(5,k) = \textbf{d}(5,j)$$

$$2^p-k = 2^p-j$$

$$-k = -j$$

$$k = j$$

Thus for $$\textbf{d}(5,k) = \textbf{d}(5,j)$$ to be true, $$k = j$$.

If q is a value in the set $$\{5,7,...,m-2,m\}$$ this proof will also be followed as formula (15) will be used then as well.

Therefore,

When $$k \neq j$$

$$\textbf{d}(q,k) \neq \textbf{d}(q,j)$$

Which means that

$$\textbf{v}_{(k)}(i_1,...,i_p) \neq \textbf{v}_{(j)}(i_1,...,i_p)$$

This means that when the coordinates of two points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ have the relationship$$(i^*_1,...,i^*_p) = (i'^*_1,...,i'^*_p)$$ and $$(i_1,...,i_p) \neq (i'_1,...,i'_p)$$, the value of $$\textbf{m}(i_1,...,i_p) \neq \textbf{m}(i'_1,...,i'_p) $$. It was also proven that when the coordinates of the points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ have the relationship $$(i^*_1,...,i^*_p) \neq (i'^*_1,...,i'^*_p)$$ and $$(i_1,...,i_p) \neq (i'_1,...,i'_p)$$, the value of $$\textbf{m}(i_1,...,i_p)$$ also is not equal to $$\textbf{m}(i'_1,...,i'_p)$$. The last possibility is that the coordinates of the points $$\textbf{m}(i_1,...,i_p)$$ and $$\textbf{m}(i'_1,...,i'_p)$$ have the relationship$$(i^*_1,...,i^*_p) \neq (i'^*_1,...,i'^*_p)$$ and $$(i_1,...,i_p) = (i'_1,...,i'_p)$$. This coordinate relationship, however, is impossible because the value of $$i^*_x$$ is calculated with $$i_x$$, so when $$i_x = i'_x$$, $$i^*_x$$ has to be the same as $$i'^*_x$$. All this combined proves that when calculating the value of two points with different coordinates within $$M^p_n$$ with the formula of $$n\equiv 2 (mod\, 4)$$, they will never have the same value.

Proof For Requirement 3

To prove requirement 3 for the formula $$n\equiv 2 (mod\, 4)$$ it has to be shown that each row has the same sum, which equals the magic constant. A row is defined as a set of points of which all coordinates are the same except for one, which will be called coordinate $$i_j$$ where j can be any value from the interval $$\{1,...,p\}$$ and the value of $$i_j$$ will be every value in the interval $$\{1,...,n\}$$. The addition of row can be represented as follows:

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

filling in formula (8)

$$\textbf{m}(i_1,...,i_p) = \textbf{m}_{(k)}(i^*_1,...,i^*_p)$$ in $$\sum_{l=1}^{n}(\textbf{m}(i_1,...,i_{j-1},l,i_{j+1},...,i_p))$$

gives

$$\sum_{l=1}^{n}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))$$

Calculating the value of k is done with formula (8)

$$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$

As shown before $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor = 1$$ when $$i_x \geq m+1$$

Since the value of the coordinates in the points $$\sum_{l=1}^{n}(\textbf{m}(i_1,...,i_{j-1},l,i_{j+1},...,i_p))$$ are the same, except for the coordinate $$i_j$$, and the value of formula (8) changes when $$i_j \geq m+1$$, the formula summation can be split in two. Due to the value of formula (8) being different when $$i_j \geq m+1$$ and $$i_j \leq m$$, the summation

$$\sum_{l=1}^{n}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))$$

can be split as follows

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))+\sum_{l=m+1}^{n}(\textbf{m}_{(s)}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))$$

Where the values of both k and s are calculated with formula (8). s is used to show that the result of formula (8) for the points in the second summation is different from that of the first summation. The value of k and s differ by $$2^{j-1}$$, because when calculating both their values with formula (8), all the values of $$i_x$$ are the same, except for when $$x=j$$ and because $$\Big \lfloor \frac{i_j-1}{m}\Big \rfloor = 0$$ when calculating k and $$\Big \lfloor \frac{i_j-1}{m}\Big \rfloor = 1$$ when calculating s, the result of s has an additional $$1*2^{j-1}=2^{j-1}$$. Therefore, $$s = k + 2^{j-1}$$. Filling this in gives

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))+\sum_{l=m+1}^{n}(\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l^*,i^*_{j+1},...,i^*_p))$$

It was shown in the proof of requirement 2 that $$l^* = min\{l,n+1-l\} = n+1-l$$ when $$l \geq m+1$$ and that $$l^* = min\{l,n+1-l\} = l$$ when $$l \leq m $$. This means that the following is true, since the maximum of the first summation is $$l=m$$ :

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))+\sum_{l=m+1}^{n}(\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},n+1-l,i^*_{j+1},...,i^*_p))$$

$$=\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))+\sum_{l=m-m+1}^{n-m}(\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},n+1-l-m,i^*_{j+1},...,i^*_p))$$

Since $$n = 2m$$, $$n-m = m$$

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))+\sum_{l=1}^{m}(\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},m+1-l,i^*_{j+1},...,i^*_p))$$

The result of $$m+1-l$$ with the interval for l being $$\{1,...,m\}$$, which is set by the second summation, has the minimum value of: $$m+1-m=1$$ and the maximum value of $$m+1-1=m$$. Combining this with the fact that the value of $$m+1-l$$ decreases per 1 when l increases by one, the result of $$m+1-l$$ will be every number from the interval $$\{1,...,m\}$$ when l takes every value within the interval $$\{1,...,m\}$$. Therefore, the following is also true:

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))+\sum_{l=1}^{m}(\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))$$

$$=\sum_{l=1}^{m}(\textbf{m}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)+\textbf{m}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))$$

Filling in formula (9) $$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$ gives:

$$\sum_{l=1}^{m}(\textbf{v}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+\textbf{m}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)+\textbf{v}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+\textbf{m}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))$$

$$=\sum_{l=1}^{m}(\textbf{v}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+\textbf{v}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+2*\textbf{m}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))$$

$$=\sum_{l=1}^{m}(\textbf{v}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+\textbf{v}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p)+\sum_{l=1}^{m}(2*\textbf{m}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))$$

It was proven in the proof of requirement 3 of the $$n\equiv 1 (mod\, 2)$$ that every line is equal to $$\frac{n(n^p+1)}{2}$$ in the magic hypercube $$M^p_n$$ that follows the formula for $$n\equiv 1 (mod\, 2)$$. It was also shown in the proof for requirement 1 that $$\textbf{m}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ follows the $$n\equiv 1 (mod\, 2)$$ and thus the following is true:

$$\sum_{l=1}^{m}(\textbf{v}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p+\textbf{v}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)m^p)+2*\frac{m(m^p+1)}{2}$$

$$=\sum_{l=1}^{m}((\textbf{v}_{(k)}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)+\textbf{v}_{(k+2^{j-1})}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p))m^p)+ m(m^p+1)$$

Filling in formula (10) $$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$ and part of formula (16) $$q = \textbf{u}(i_1,...,i_p) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1$$ gives:

$$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k)+\textbf{d}((\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k+2^{j-1})))m^p)+ m(m^p+1)$$

The calculation of $$\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ is done with formula (16) $$q = \textbf{u}(i_1,...,i_p) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1$$. When calculating the value of $$\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ for different values of l, all coordinates except $$i_j$$ are the same. This means that when l increases by 1, the result of the summation $$\sum_{x=1}^{p}(-1)^{x-1}i_x$$ decreases by 1 when j is even or increases by 1 when j is odd. Since the value of l is every number in the interval $$\{1,...,m\}$$, the values from the interval $$\{1,...,m\}$$ will be added when j is odd and when j is even a value from the interval $$\{-m,...,-1\}$$ will be added. Due to the $$(mod \, m)$$ after the summation in formula (16) the actual effect of l will be a number from the interval $$\{0,...,m-1\}$$ when j is odd and $$\{-m+1,...,0\}$$ when j is even. Since the other coordinates stay the same and only l changes and due to the $$(mod \, m)$$ at the end of the summation, the result of the $$(\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)$$ will have the interval $$\{0,...,m-1\}$$ as the $$(mod \, m)$$ prevents the result from becoming negative. Due to the +1 at the end of the equation, the results of $$\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ in $$\sum_{l=1}^{m}\textbf{u}(i^*_1,...,i^*_{j-1})$$ will be all numbers in the interval $$\{1,...,m\}$$. And since $$l$$ and $$\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ both take all values from the same interval, $$\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p)$$ can be replaced by l in the formula.

Since $$k$$ and $$k+2^{j-1}$$ stay consistent when alternating l, the result of $$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k))$$ is the addition of all values in column k of table $$\textbf{D}$$ and $$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k+2^{j-1}))$$ has the value of the sum of all values in column $$k+2^{j-1}$$ of table $$\textbf{D}$$.

The addition of a column is calculated with formula (11) through (15), where formula (14) and (15) can be used multiple times, when $$l>3$$.

(11) $$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

(12) $$\textbf{d}(2,x) = 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$

(13) $$\textbf{d}(3,x) = (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2)$$

(14) $$\textbf{d}(l,x) = x-1, \, l=4,6,8,10,...,m-1$$

(15) $$\textbf{d}(l,x) = 2^p-x, \, l=5,7,9,11,...,m$$

The amount of times that formula (14) and (15) have to be used can be written as follows: $$\frac{m-3}{2}$$ as it should not take place when l is 1,2 or 3 as formula(11),(12) and (13) handle those, therefore, the minus 3. Since the maximum value of l is m it should take place the resulting times. The division of 2 is there since half of the times formula (14) has to be used and half of the times formula (15). Thus the addition of a column in table $$\textbf{D}$$ is the following:

$$\sum_{j=1}^{m}(\textbf{d}(j,x))= \textbf{d}(1,x) + \textbf{d}(2,x) + \textbf{d}(3,x) + \frac{m-3}{2}*(\textbf{d}(4,x)) + \frac{m-3}{2}(\textbf{d}(5,x))$$

$$= \textbf{d}(1,x) + \textbf{d}(2,x) + \textbf{d}(3,x) + \frac{m-3}{2}*(\textbf{d}(4,x)+\textbf{d}(5,x))$$

Filling in the formulas (11) through (15) gives

$$2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor + 2^{p-1}*2^{(x+1)(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + \frac{m-3}{2}*(x-1+2^p-x)$$

$$=2^{p-1}*2^{x(mod \, 2)} + 2^{p-1}*2^{(x+1)(mod \, 2)}-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + \frac{m-3}{2}*(2^p-1)$$

Since either $$x(mod \, 2) = 1$$ or $$(x+1)(mod \, 2) = 1$$ the following is true:

$$2^{p-1}*2^1 + 2^{p-1}*2^0-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + (\frac{m}{2}-1\frac{1}{2})*(2^p-1)$$

$$=2^p + 2^{p-1}-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)-1\frac{1}{2}*2^p-1\frac{1}{2}*-1$$

$$=2^p + 2^{p-1}-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)-1*2^p-\frac{1}{2}*2^p+1\frac{1}{2}$$

$$=2^p + 2^{p-1}-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)-2^p-2^{-1}*2^p+1\frac{1}{2}$$

$$=2^p-2^p + 2^{p-1}-2^{p-1}-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) - 1 + 1\frac{1}{2} + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)$$

$$=-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) +\frac{1}{2} + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)$$

$$=(x+1)-(x+1)-2*\Big \lfloor \frac{x+1}{2} \Big \rfloor + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) +\frac{1}{2} + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)$$

$$=-(x+1)+(x+1)(mod \,2) + (x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) +\frac{1}{2} + x - (x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)$$

$$=(x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) +\frac{1}{2}-1 + x-x - (x+1)(mod \,2) +(x+1)(mod \,2) + (\frac{m}{2})*(2^p-1)$$

$$=(x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2) -\frac{1}{2} + (\frac{m}{2})*(2^p-1)$$

The calculation of k and $$k+2^{j-1}$$ differ by $$2^{j-1}$$. Since the $$(x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2)$$ calculates whether $$k-1$$ and $$k+2^{j-1}-1$$ have an even or odd amount of 1’s in the binary representation. The minus one removes the 1 at the end of formula (8) $$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$. Since the values of $$k-1$$ and $$k+2^{j-1}-1$$ also differ by $$2^{j-1}$$, the digit that is equal to the value $$2^{j-1}$$ is 0 in the binary representation of $$k-1$$ and 1 in the binary representation of $$k+2^{j-1}-1$$. Since the rest of the digits in the binary representation of $$k-1$$ and $$k+2^{j-1}-1$$ are the same, $$k+2^{j-1}-1$$ has 1 extra 1 in its binary representation. Thus the result of $$(x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2)$$ will differ for $$k$$ and $$k+2^{j-1}$$. So if $$k-1$$ has an odd amount of 1 digits in its binary representation, then filling in the summation found for $$\sum_{j=1}^{m}(\textbf{d}(l,x))$$ in

$$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k)+\textbf{d}((\textbf{u}(i^*_1,...,i^*_{j-1},l,i^*_{j+1},...,i^*_p),k+2^{j-1})))m^p)+ m(m^p+1)$$

gives:

$$((k - \sum_{y=1}^{log(k,2)+1}(\Big \lfloor \frac{k-1}{2^y} \Big \rfloor)-1)(mod \,2) -\frac{1}{2} + (\frac{m}{2})*(2^p-1)+(k+2^{j-1} - \sum_{y=1}^{log(k+2^{j-1},2)+1}(\Big \lfloor \frac{k+2^{j-1}-1}{2^y} \Big \rfloor)-1)(mod \,2) -\frac{1}{2} + (\frac{m}{2})*(2^p-1))m^p+ m(m^p+1)$$

$$=(1 -\frac{1}{2} + (\frac{m}{2})*(2^p-1)+ 0 -\frac{1}{2} + (\frac{m}{2})*(2^p-1))m^{p}+ m(m^p+1)$$

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

$$=(m*(2^p-1))m^{p}+ m(m^p+1)$$

$$=(m*2^p-m)m^{p}+ m(m^p+1)$$

$$=m^{p+1}*2^p-m^{p+1}+ m^{p+1} + m$$

$$=m^{p+1}*2^p+m$$

Filling in $$m = \frac{n}{2}$$ gives

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

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

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

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

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

Filling in for $$k+2^{j-1}-1$$ having an odd amount of 1 digits in its binary representation just swaps the 0 and 1 result of $$(x - \sum_{y=1}^{log(x,2)+1}(\Big \lfloor \frac{x-1}{2^y} \Big \rfloor)-1)(mod \,2)$$. This does not matter however because their result is added so the result will be the same. The result $$\frac{n(n^{p}+1)}{2}$$ is the magic constant and thus the proof of requirement 3 is completed.

Proof For Requirement 4

The last part that has to be proven is that each main diagonal has the same sum as that of the rows and also equals the magic constant. A diagonal follows the following relationship within formula (7):

$$\sum_{l=1}^{n}(\textbf{m}(l^* \lor (n-l+1)^*,l^* \lor (n-l+1)^*,...,l^* \lor (n-l+1)^*,l^* \lor (n-l+1)^*))=\sum_{l=1}^{m}(\textbf{m}_{(k)}(l,l,...,l,l))+\sum_{l=m+1}^{n}(\textbf{m}_{(j)}(l,l,...,l,l))$$

Where $$l^* \lor (n-l+1)^*$$ means that the coordinate is either the value of $$l^* $$ or $$(n-l+1)^*$$.

Just like with the proof of requirement 3 of this formula the summation is split in 2 due to the result of formula (8) being different when $$i_x \geq m+1$$ and $$i_x \leq m$$. Since the value of each coordinate in point $$\textbf{m}(l^* \lor (n-l+1)^*,l^* \lor (n-l+1)^*,...,l^* \lor (n-l+1)^*,l^* \lor (n-l+1)^*)$$ either increases or decreases by 1 when l increases by 1, the result of $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ in formula (8) will differ for every x when $$l \geq m+1$$ and $$l \leq m$$.

As shown in the proof of requirement 1, the result of formula (8) $$k = \sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}) + 1$$ lies within the interval $$\{1,...,2^p\}$$. Excluding the +1 at the end of the equation gives the interval $$\{0,...,2^p-1\}$$ for $$\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1}$$. Since k is calculated when $$l \leq m$$ and j when $$l \geq m+1$$, every $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor = 1$$ when calculating k gives $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor = 0$$ when calculating j and vice versa. The maximum of $$2^p-1$$ of formula (8) is reached when the result of $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ is always 1. This can be replicated by adding k and j, as for every coordinate the result of $$\Big \lfloor \frac{i_x-1}{m} \Big \rfloor$$ is 1 for one and 0 for the other. Therefore:

$$k-1 + j - 1 = 2^p-1$$

$$j - 1 = 2^p-k$$

$$j = 2^p-k+1$$

The -1 is added as the +1 add the end of formula(8) was disregarded when looking at the maximum result of $$\sum_{x=1}^{p}(\Big \lfloor \frac{i_x-1}{m}\Big \rfloor*2^{x-1})$$

This gives

$$\sum_{l=1}^{m}(\textbf{m}_{(k)}(l,l,...,l,l))+\sum_{l=m+1}^{n}(\textbf{m}_{(2^p-k+1)}(n+1-l,n+1-l,...,n+1-l,n+1-l))$$

$$=\sum_{l=1}^{m}(\textbf{m}_{(k)}(l,l,...,l,l))+\sum_{l=1}^{m}(\textbf{m}_{(2^p-k+1)}(m+1-l,m+1-l,...,m+1-l,m+1-l))$$

Since the result of $$m+1-l$$ with the interval for l being $$\{1,...,m\}$$,which is set by the second summation, has the minimum value of: $$m+1-m=1$$ and the maximum value of $$m+1-1=m$$ and the value of $$m+1-l$$ decreases per 1 when l increases by one, the result of the equation will be every number from the interval $$\{1,...,m\}$$ when l takes every value within the interval $$\{1,...,m\}$$. Therefore, the following is also true:

$$=\sum_{l=1}^{m}(\textbf{m}_{(k)}(l,l,...,l,l))+\sum_{l=1}^{m}(\textbf{m}_{(2^p-k+1)}(l,l,...,l,l))$$

$$=\sum_{l=1}^{m}(\textbf{m}_{(k)}(l,l,...,l,l)+\textbf{m}_{(2^p-k+1)}(l,l,...,l,l))$$

Filling in formula (9) gives $$\textbf{m}_{(k)}(i_1,...,i_p) = \textbf{v}_{(k)}(i_1,...,i_p)m^p + \textbf{m}(i_1,...,i_p)$$ gives:

$$\sum_{l=1}^{m}(\textbf{v}_{(k)}(l,l,...,l,l)m^p+\textbf{m}(l,l,...,l,l)+\textbf{v}_{(2^p-k+1)}(l,l,...,l,l)m^p + \textbf{m}(l,l,...,l,l))$$

$$\sum_{l=1}^{m}((\textbf{v}_{(k)}(l,l,...,l,l)+\textbf{v}_{(2^p-k+1)}(l,l,...,l,l))m^p+ 2*\textbf{m}(l,l,...,l,l))$$

$$\sum_{l=1}^{m}((\textbf{v}_{(k)}(l,l,...,l,l)+\textbf{v}_{(2^p-k+1)}(l,l,...,l,l))m^p)+ 2*\sum_{l=1}^{m}(\textbf{m}(l,l,...,l,l))$$

As was proven in requirement 3 of $$n\equiv 1 (mod\, 2)$$, the sum of every diagonal is equal to $$\frac{n(n^p+1)}{2}$$. Thus $$\sum_{l=1}^{m}(\textbf{m}(l,l,...,l,l) = \frac{m(m^p+1)}{2}$$ as it follows the $$n\equiv 1 (mod\, 2)$$. This gives:

$$\sum_{l=1}^{m}((\textbf{v}_{(k)}(l,l,...,l,l)+\textbf{v}_{(2^p-k+1)}(l,l,...,l,l))m^p)+ 2*\frac{m(m^p+1)}{2}$$

$$=\sum_{l=1}^{m}((\textbf{v}_{(k)}(l,l,...,l,l)+\textbf{v}_{(2^p-k+1)}(l,l,...,l,l))m^p)+ m(m^p+1)$$

Filling in formula (10) $$ \textbf{v}_{(k)}(i_1,...,i_p) = \textbf{d}(q,k)$$ and part of formula (16) $$q = \textbf{u}(i_1,...,i_p) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1$$ gives:

$$=\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(l,l,...,l,l),k)+\textbf{d}(\textbf{u}(l,l,...,l,l),2^p-k+1))m^p+ m(m^p+1)$$

The value of $$\textbf{u}(l,l,...,l,l)$$ depends on whether p is even or odd. if p is odd then:

$$\textbf{u}(l,l,...,l,l) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1 = ((\frac{p}{2}+1)*1*l+\frac{p}{2}*-1*l)(mod \, m)+1 =(l+\frac{p}{2}*l-\frac{p}{2}*l)(mod \, m)+1 = (l)(mod \, m)+1$$

So when p is odd, the deciding factor of the result of $$\textbf{u}(l,l,...,l,l)$$ is l, just like with the proof for requirement 3. The parity of the amount of 1’s in the binary representation of k-1 and 2^p-k is also different. This is because when a digit in the binary representation of k-1 is 1 then it is 0 in the binary representation of 2^p-k and since the binary representation of these values has an odd number of digits because p is odd, the parity of the amount of 1’s differ, as only odd+even = odd. Therefore, when p is odd the calculation of $$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(l,l,...,l,l),k)+\textbf{d}(\textbf{u}(l,l,...,l,l),2^p-k+1))m^p+ m(m^p+1)$$ further follows the proof of requirement 3 as the parity of the number of 1’s in the binary representation of the values $$k-1$$ and $$2^p-k$$ differ and because only one coordinate decides the result of q which will equal every value within the interval $$\{1,...,m\}$$. This means that when p is odd, the sum of all points on a diagonal equals the magic constant.

If p is even then:

$$\textbf{u}(l,l,...,l,l) = (\sum_{x=1}^{p}(-1)^{x-1}i_x)(mod \, m)+1 = (\frac{p}{2}*1*l+\frac{p}{2}*-1*l)(mod \, m)+1 = (0)(mod \, m)+1 = 1$$

Filling this in $$\sum_{l=1}^{m}(\textbf{d}(\textbf{u}(l,l,...,l,l),k)+\textbf{d}(\textbf{u}(l,l,...,l,l),2^p-k+1))m^p+ m(m^p+1)$$ gives:

$$\sum_{l=1}^{m}(\textbf{d}(1,k)+\textbf{d}(1,2^p-k+1))m^p+ m(m^p+1)$$

To calculate the value of $$\textbf{d}(1,k)$$ and $$\textbf{d}(1,2^p-k+1)$$ formula (11) has to be used.

formula (11) $$\textbf{d}(1,x) = 2^{p-1}*2^{x(mod \, 2)}-\Big \lfloor \frac{x+1}{2} \Big \rfloor$$ gives:

$$\sum_{l=1}^{m}(\textbf{d}(1,k)+\textbf{d}(1,2^p-k+1))m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p-1}*2^{k(mod \, 2)}-\Big \lfloor \frac{k+1}{2} \Big \rfloor+2^{p-1}*2^{(2^p-k+1)(mod \, 2)}-\Big \lfloor \frac{2^p-k+1+1}{2} \Big \rfloor)m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p-1}*2^{k(mod \, 2)}-\Big \lfloor \frac{k+1}{2} \Big \rfloor+2^{p-1}*2^{(2^p-k+1)(mod \, 2)}-\Big \lfloor \frac{2^p-k+2}{2} \Big \rfloor)m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p-1}*2^{k(mod \, 2)}+2^{p-1}*2^{(-k+1)(mod \, 2)}-\Big \lfloor \frac{k+1}{2} \Big \rfloor-\Big \lfloor 2^{p-1} + 1 - \frac{k}{2} \Big \rfloor)m^p+ m(m^p+1)$$

If k is even, then

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

$$(-k+1)(mod \, 2) = 1$$

$$\Big \lfloor \frac{k+1}{2} \Big \rfloor = \frac{k}{2} $$

$$\Big \lfloor 2^{p-1} + 1 - \frac{k}{2} \Big \rfloor = 2^{p-1} + 1 - \frac{k}{2}$$

Which gives:

$$\sum_{l=1}^{m}(2^{p-1}*2^{0}+2^{p-1}*2^{1}- \frac{k}{2}- (2^{p-1} + 1 - \frac{k}{2}))m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p-1}+2^{p}- \frac{k}{2} - 2^{p-1} - 1 + \frac{k}{2})m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p} - 1)m^p+ m(m^p+1)$$

If k is odd, then

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

$$(-k+1)(mod \, 2) = 0$$

$$\Big \lfloor \frac{k+1}{2} \Big \rfloor = \frac{k+1}{2} $$

$$\Big \lfloor 2^{p-1} + 1 - \frac{k}{2} \Big \rfloor = 2^{p-1} + 1 - \frac{k+1}{2}$$

Which gives:

$$\sum_{l=1}^{m}(2^{p-1}*2^{1}+2^{p-1}*2^{0}-\frac{k+1}{2}-(2^{p-1} + 1 - \frac{k+1}{2}))m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p}+2^{p-1}-\frac{k+1}{2}-2^{p-1} - 1 + \frac{k+1}{2}))m^p+ m(m^p+1)$$

$$=\sum_{l=1}^{m}(2^{p}-1)m^p+ m(m^p+1)$$

Thus when k is even or odd $$=\sum_{l=1}^{m}(2^{p-1}*2^{k(mod \, 2)}+2^{p-1}*2^{(-k+1)(mod \, 2)}-\Big \lfloor \frac{k+1}{2} \Big \rfloor-\Big \lfloor 2^{p-1} + 1 - \frac{k}{2} \Big \rfloor)m^p+ m(m^p+1)=\sum_{l=1}^{m}(2^{p}-1)m^p+ m(m^p+1)$$

and, therefore, for every k when p is even, the following is true:

$$\sum_{l=1}^{m}(2^{p}-1)m^p+ m(m^p+1)$$

$$=(2^{p}-1)m*m^p+ m(m^p+1)$$

$$=(2^{p}-1)m^{p+1}+ m(m^p+1)$$

$$=(2^{p}-1)m^{p+1}+ m^{p+1}+m$$

$$=(2^{p}-1+1)m^{p+1}+m$$

$$=(2^{p})m^{p+1}+m$$

Filling in $$m = \frac{n}{2}$$ gives

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

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

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

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

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

Which is the magic constant. So, when p is either even or odd all main diagonals have a sum that equals the magic constant. This completes the proof of requirement 4 and with that the proof for $$n\equiv 2 (mod\, 4)$$ and that there exists a magic hypercube filled with consecutive numbers without any duplicates with a size bigger than 1 and not being equal to 2 and for every dimension bigger than 1.