+ 2

[CHALLENGE] Magic Hypercube

Let's write a program that inputs: 1. Number of dimensions that a hypercube has 2. Length of edge of the hypercube 3. Set of numbers And outputs: 1. Is it possible to arrange numbers so that they form a magic hypercube (YES or NO) 2. (If YES) Number of configurations that form a magic hypercube 3. (if YES) list of configurations that apply Over this: We don't want to have situation like this: Input: 2/2/1,1,1,1 Output: Yes/24 configurtions / {1,1}{1,1}->printed 24 times

10th Dec 2017, 10:06 AM
Amadeus
Amadeus - avatar
6 ответов
+ 4
I think I've had a magic hypercube (or at least an interesting progression) hidden away in Private codes for a week or so; when I wrote a Java solution for word permutations (a convenient hypercube base: 2x2x2x2, easily generalized to any dimension and side length). Because the array interleaving is hard to visualize (and I figured, only fascinating to me), I stalled to work on a manual 3D projection and got pulled into equipment issues / forum stuff...I'll see what I have to fix and come back. Not in C# though ... I did c++ and javascript, inspired by Java. So, I won't meet the language requirement, just the concept.
12th Dec 2017, 5:11 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Does this mean that the sum of all sets of elements with all but one fixed indexes is constant? That is, here is the analogy with the magic square?
10th Dec 2017, 1:42 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
This is analogic to the magic square, but in any number of dimensions.
10th Dec 2017, 2:27 PM
Amadeus
Amadeus - avatar
+ 1
For exampe: int[,,] arr = new int[,,]{{{26, 6, 10},{12, 25, 5},{4, 11, 12}},{{15, 19, 8},{7, 14, 21},{20, 9, 13}},{{1, 17, 24},{23, 3, 16},{18, 22, 2}}}; Example of magic cube rewritten from https://www.google.pl/search?q=magic+hypercube&client=ms-android-huawei&prmd=ivsn&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjUwbrc0__XAhUPGuwKHfU6BqgQ_AUIESgB&biw=360&bih=511#imgrc=Un-_k6Pq5YCqhM:
10th Dec 2017, 2:42 PM
Amadeus
Amadeus - avatar
+ 1
@Kirk Schafer Good luck!
12th Dec 2017, 7:14 PM
Amadeus
Amadeus - avatar
0
The condition of the problem is unclear. What does it mean for the numbers "they form a magic hypercube"?
10th Dec 2017, 1:18 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar