The Magic Encyclopedia ™

{perfect} hypercubes of odd order
(also: {pandiagonal pan-r-agonal (any r=3..n)} )
{note: investigative article}
(by Aale de Winkel)

This article combines my investigation of prime and composite orders into a single "theory" for both types of orders. Below I concentrate upon creating hypercubes of {perfect} quality though the means provided allows to figure hypercubes of lesser quality, an option I'll probably describe in some future upload in this or a seperate article.

Note: "Plancks theory of Path Nasiks (1905)" seems to have conditions based on determinants. The scanned article I've seen is based on Frost method (probably widely in use at that time) since it is merely noted. The cubes I have of Frost I could reobtain by the "LP"-method, though <Günter Sterten> claims that Planck uses the modular equation on the LHS permuting the cube coordinates the value is stored. Though I tried to implement this variation (triggered by 'PC' (for Path Cube), it ain't reproducing the order 27 perfect cube yet, nor doe it produce other hypercubes of usefull quality. therefore I've no experiece with the "PC"-method yet, nor do I currently see determinant to po up in the "LP"-method. In case "PC" and "LP" where related I gather I would have gotte an "LP"-prescription from my program for the order 27 {perfect} cube Günter claims to have produve using the "PC"-method. (I leave this for future investigation)

{perfect} hypercubes of odd order
basic ingredients of perfect hypercubes denoted by:
LP(....{a0,...,an-1}=[perm(0,..,m-1)],....)
Component parameters
{a0,...,an-1}
parameters to create a component by formula
LP({a1,...,an}) [ji] = (j=0n-1aj ji) % m
Note: to explain the above for the square this means:
LP({a1,a2}) [x,y] = (a0 x + a1 y) % m
digit permutation
=[perm(0,..,m-1)]
permutation to change digits
LP[ji] <-- perm[LP[ji]]
Note: simple replacement of value given by the permutation
further ingredients
r-agonal pathfinder
<v0,...,vn-1>
n-Vector denoting the direction of the r-agonal
vi = -1,0,1
Note: r-agonal directions are given by n-vectors with only values -1,0,1
formula's use general 'v' since they are also valid for other vectors
inproduct
<v1,v2>
mathematical notion
<v1,v2> = j=0n-1 (v1j v2j)
Note: v1 and v2 are two n-Vectors, the in(ner)product denotes a number
in our case an integer whis should be taken %m.
component conciderations given a pathfinder
LP({a0,...,an-1}) <v0,...,vn-1> = (LP[k==0] + k<<a0,...,an-1>,<v0,...,vn-1>>) % m ; k = 0.. m-1
the numbers on an r-agonal turn out to be a constant plus a sequence of numbers
given by the inproduct of the parameters and the r-agonals pathfinder
<<a0,...,an-1>,<v0,...,vn-1>>
relatively prime to m
all digits present on these r-agonals
these r-agonals naturally sum to Sm = m (m-1) / 2
<<a0,...,an-1>,<v0,...,vn-1>>
NOT relatively prime to m
the r-agonals show q times the same s digits (q s = m)
q = lcm(m,<<a0,...,an-1>,<v0,...,vn-1>>) / <<a0,...,an-1>,<v0,...,vn-1>>
s = m / q
these r-agonals sum to:
m LP[k==0] + q k=0s-1 {(k<<a0,...,an-1>,<v0,...,vn-1>>) % m} =
m LP[k==0] + q min{(k<<a0,...,an-1>,<v0,...,vn-1>>) % m; k=1..s-1} Ss =
m LP[k==0] + q gcd(m,q) Ss =
so the lines that do sum have:
LP[k==0] = (Sm - q gcd(m,q) Ss) / m
one can probably always panrelocate to posititions where the above values LP[k==0]
fall on the main r-agonals making the hypercube {magic} for these r-agonals
in order to make all r-agonals sum one needs to digit-change such that:
k=0m perm[LP({a0,...,an-1}) <v0,...,vn-1>] =
k=0m perm[(LP[k==0] + k<<a0,...,an-1>,<v0,...,vn-1>>) % m)] = Sm
the diagonals of s by q {magic} rectangles provide such permutations


Figuring out the number of components in normalized position I first obtained after some figuring the expression
(m-3)!! / {[m-(2n+1)]!! * 2 (n-1)1]}
however since I was looking at Pascal's triangle it was clearly also
((m-3)/2n-1)
a little mathematical figuring conviced me that these two formulaes are equal. In my prime order hypercube article I failed to see this. The following makes an attempt to give a counting argument for the number of {pandiagonal} hypercube. The number of {perfect} hypercube is a (yet to be determined) fraction thereof. Note that one might filter out the r-agonals according to the quality of interest so the {pandiagonal panquadragonal} tesseract one might be looking for. Note that the parameters assume {pandiagonal}ity, so you might need to change something in case you are interested in the {non-pandiagonal} (might be interesting to look into).

I think the above table is complete, the table below will be scrutenized against my other articles (see pe panmagic squares of prime order, the below should give those results for (n,m) = (2,prime))

counting {pandiagonal} hypercubes of odd order
Basic Components
LP({1,a1,...,an-1})
factor: Bn,m = ((m-3)/2n-1)
quality: {pandiagonal}
concidering the digit change option one can set a0 = 1,
to put the component in normalized position one set ak > ak-1,
to avoid reflected variants we limit an-1 <= (m-1) / 2
giving the above conditions it can be deduced that there exist
Bn,m = ((m-3)/2n-1)
such basic components
Note: The quality of these "Basic Hypercubes" is {pandiagonal}, filtering out the
{perfect} is subject to investigation
Bn,m = ((m-3)/2n-1)
m\n 1 2 3 4 5 6 7
3
5
7
9
11
13
15
1
1
1
1
1
1
1

1
2
3
4
5
6


1
3
6
10
15



1
4
10
20




1
5
15





1
6






1
combining components
In order to get a magic hypercube n components needs to be combined in thus a manner as to
avoid double appearing numbers. Component with different parameters can be combined as well
as different aspects of the same components. Below I keep the hypercube in normalized position
and obtain the aomount of {pandiagonal} hypercubes. Numbers Dn,m yet to be determined
Basic Hypercubes
LP(...,{1,a1,...,an-1},..)
factor:
Bn,m [ 2n-1 Bn,m - 1 ] ! /
[ 2n-1 Bn,m - n ] !)
quality: {pandiagonal}
Combining Basic Components give the basic hypercubes
Choosing the highest component out of the Bn,m possibil1ties selects one of the
possible 2n-1 Bn,m that exist for the lower components, the factor 2 n-1 is caused
by reflecting the parameters ai --> m-ai i=1..n-1 ; thus gives a factor
Bn,m (2n-1Bn,m-1 n-1)
the lower components can of course permute there position giving an extra (n-1)! resulting in:
Bn,m [ 2n-1 Bn,m - 1 ] ! / [ 2n-1 Bn,m - n ] !)
Note: The quality of these "Basic Hypercubes" is {pandiagonal}
this reproduces the numbers in the {perfect} square article as well as
predict the 6 order 7 {pandiagonal} cubes order 7 uploaded onto the database
Bn,m [ 2n-1 Bn,m - 1 ] ! / [ 2n-1 Bn,m - n ] !)
m\n 1 2 3 4 5 6 7
3
5
7
9
11
13
15
1
1
1
1
1
1
1

1
6
15
28
45
66


6
330
3,036
14,820
51.330



210
107,880
4,744,740
78,883,080




32,760
180,300,120
47,722,860,360





20,389,320
1,446,769,946,160






48,920,775,120
Basic Hypercubes
LP(...,{1,a1,...,an-1},..)
compond orders
factor:
unknown
Combining Basic Components compund order
For compound order the situaton is a bitmore difficult. The general combinations calculted above
give multipe appearing numbers when the differance or factors is an integral multiple of the
factors of the order, suppose m = qr then
(a + kq) r = (ar + kqr) = ar + km = ar (mod m)
which confirms the fact stated. Yet I don't know a solid counting argument which give me the numbers
mentioned below.
I'm looking for a solid counting argument though.
NOTE These numbers not yet incorporated into the following tables, nor have I not figure out
wheter the multiple numbers can be controlled by some mixture of digit changing permutation
experimental estimate
m\n 2 factors
9
15
21
25
27
33
35
39
45
49
12
39
93
193
192
273
351
388
471
906
3*3
3*5
3*7
5*5
3*3*3
3*11
5*7
3*13
3*3*5
7*7
{pandiagonal} hypercubes
in normalized position
amount:
Fn,m *
(m-1)!n-1 (m-2n-1)! *
(m-12n) (2n-1)! *
Bn,m [ 2n-1 Bn,m - 1 ] ! /
[ 2n-1 Bn,m - n ] !)
lower component digit permutations completes the proces
To keep the highet component in normalized position the used digit changing permutation
are limited to those where one randomlyselect 2n numbers to be placed on the i'th monagonal
through [j0] at the first (Pi) and last (Ri) thus that:
P0 < Pi < Ri < Pi+1 < Ri+1 < R0 ; i = 1..n-2
except for the lowest these can permute, thus explains (m-12n) (2n-1)!
the orher (m-1-2n) numbers can be randomly permuted: (m-1-2n)!
the lower components all permutations [0,perm(1,m-1)] can be used: (m-1)n-1
(m-1)!n-1 (m-2n-1)! (m-12n) (2n-1)! Bn,m [ 2n-1 Bn,m - 1 ] ! / [ 2n-1 Bn,m - n ] !)
note; numbers are huge so numbers not displayed
m\n 2 3
3
5
7
9
11
13
15

144
777,600
6,096,384,000
92,177,326,080,000
2,581,228,494,028,800,000
125,400,898,533,107,957,760,000


373,248,000
3,605,157,642,240,000
24,179,071,274,975,232,000,000
271,461,250,591,582,448,517,120,000,000
5,668,198,751,497,959,264,452,912,087,040,000,000
(BE AWARE: this reasoning is generalized from known data for prime order squares (so highly speculative))
the reader is invited to check the reasoning carefully and point out a better one.
The not explained factor Fn,m is added to denote the fraction of working permutation
yet to be determined (see 1st table above) several factors are entering here at various places
I do think this amounts to a global (integral) fraction of the amount given above.
note: the numbers above give the amount of {pandiagonal} hypercubes in normalized position
I haven't factored in the "not working" permutations which might effect the numbers in the
case of compound order, so the above numbers can be taken as an "upper-bound". Currently
don't see a flaw in the reaoning but is subject to scruteny upon the factor 2n-1 / (2n-1)!!
numbers will be corrected to this factor next week.

NOTE: short ad hoc peak at order 3p (esp. order 9 square
Since <<1,2,...>,<1,1,..>> = 3 the line along this direction read (LP[k==0] + 3k) % m which for order 3p are thrice the same p digits (k = 0..p-1) so Fn,3p is the fraction of permutation satisfing:
i=0pperm[k + 3i] = m(m-1)/2 ; k = 0..2
note that this is the diagonal of a 3 by p magic rectangle, where the rows can be freely permuted. the order 3 square holds 3 rectangles, giving the freedom to permute rows give 2 * 3!3 = 432 = 3 * 144 permutation out of 9! = 362,880 so a fraction of 1/840 (for order 9??) so Fn,9 = 1/840 so there are 7,257,600 panmagic squares order 9.
note this is a rough calculation, I don't know whether it is valid
also the amout of combined "Basic Squares" reduces to 12 since the verticals read:
{1,2} : 0,2,4,6,8,1,3,5,7
(1,3} : 0,3,6,0,3,6,0,3,6
{1,4} : 0,4,8,3,7,2,6,1,5
{1,5} : 0,5,1,6,2,7,3,8,4
{1,6} : 0,6,3,0,6,3,0,6,3
{1,7} : 0,7,5,3,1,8,6,4,2
which show the same digits on the pairs ({1,2},{1,5} (6 and 3}), {{1,3},{1,6} (0's) and ((1,4},{1,7} (3 and 6)) at the same position and thus the combined give a faulty numberrange This sample suggest that in pairing of {1,a} and {1,b} we need to impose the condition that b-a relatively prime to m. a condition which need to be verified on other orders. thus not only the digit changing permutation are limited but also the combination. Simular thing need to be investigated for the higher dimensional objects, it might be that two Basic cubes can have digits on the same place provided the third is different!
This leads to the argument mentioned above in the incomplete table withous counting argument

The above is preliminairy, augmented soon!

The spreadsheet QualityTest.zip provide an overview of the above discussed from square to tesseract for order 3 to 49. Added a "compound order" sheet to count the working LP-combinations for the square.