Can you assign twelve distinct positive integers, one to each edge of a cube, so that the sum of the three numbers assigned to the edges forming a vertex is always the same, and the total sum of the assigned numbers is minimized?
For referencing purposes, let the cube have vertices with coordinates: A(0,0,0), B(1,0,0), C(1,1,0), D(0,1,0), E(0,0,1), F(1,0,1), G(1,1,1), and H(0,1,1), so that the edges are: AB, BC, CD, DA, EF, FG, GH, HE, AE, BF, CG, and DH.
As the integers are all different and positive, they must add up to at least the sum of the first 12 positive integers, or 78.
Each edge value counts into two vertices, so the total of the vertices' values is twice the total of the edge values. The average, then, of the eight vertices is then twice the edge total divided by eight. As each vertex is to have the same total value, that value must be the average value, or the total of the edges, divided by four.
Thus the total must be divisible by four. The first number divisible by four and at least 78 is 80. The following program starts at 80, and in fact need not have looked further, as there are solutions where the total is 80.
Dim goAhead, getOut
Private Sub Command1_Click()
MousePointer = vbHourglass
For total = 80 To 200 Step 4
DoEvents
Print total
eachVertex = total / 4
ReDim Number(12)
For n1 = 1 To (total - 1) / 12: Number(1) = n1: sofar1 = Number(1): DoEvents
For n2 = n1 + 1 To (total - sofar1 - 1) / 11: Number(2) = n2: sofar2 = sofar1 + Number(2): DoEvents
For n3 = Number(2) + 1 To (total - sofar2 - 1) / 10: Number(3) = n3: sofar3 = sofar2 + Number(3): DoEvents
For n4 = Number(3) + 1 To (total - sofar3 - 1) / 9: Number(4) = n4: sofar4 = sofar3 + Number(4): DoEvents
For n5 = Number(4) + 1 To (total - sofar4 - 1) / 8: Number(5) = n5: sofar5 = sofar4 + Number(5): DoEvents
For n6 = Number(5) + 1 To (total - sofar5 - 1) / 7: Number(6) = n6: sofar6 = sofar5 + Number(6): DoEvents
For n7 = Number(6) + 1 To (total - sofar6 - 1) / 6: Number(7) = n7: sofar7 = sofar6 + Number(7): DoEvents
For n8 = Number(7) + 1 To (total - sofar7 - 1) / 5: Number(8) = n8: sofar8 = sofar7 + Number(8): DoEvents
For n9 = Number(8) + 1 To (total - sofar8 - 1) / 4: Number(9) = n9: sofar9 = sofar8 + Number(9): DoEvents
For n10 = Number(9) + 1 To (total - sofar9 - 1) / 3: Number(10) = n10: sofar10 = sofar9 + Number(10): DoEvents
For n11 = Number(10) + 1 To (total - sofar10 - 1) / 2: Number(11) = n11: sofar11 = sofar10 + Number(11): DoEvents
For n12 = Number(11) + 1 To (total - sofar11): Number(12) = n12: sofar12 = sofar11 + Number(12): DoEvents
If sofar12 = total Then
ReDim edge(12), used(12)
edge(1) = Number(1)
used(1) = 1
For e2sub = 2 To 11
edge(2) = Number(e2sub)
used(e2sub) = 1
For e3sub = e2sub + 1 To 12
edge(3) = Number(e3sub)
used(e3sub) = 1
If edge(1) + edge(2) + edge(3) = eachVertex Then
For e4sub = 2 To 12
If used(e4sub) = 0 Then
used(e4sub) = 1
edge(4) = Number(e4sub)
For e5sub = 2 To 12
If used(e5sub) = 0 Then
used(e5sub) = 1
edge(5) = Number(e5sub)
If edge(1) + edge(4) + edge(5) = eachVertex Then
For e6sub = 2 To 12
If used(e6sub) = 0 Then
used(e6sub) = 1
edge(6) = Number(e6sub)
For e7sub = 2 To 12
If used(e7sub) = 0 Then
used(e7sub) = 1
edge(7) = Number(e7sub)
If edge(4) + edge(6) + edge(7) = eachVertex Then
For e8sub = 2 To 12
If used(e8sub) = 0 Then
used(e8sub) = 1
edge(8) = Number(e8sub)
If edge(2) + edge(6) + edge(8) = eachVertex Then
For e9sub = 2 To 12
If used(e9sub) = 0 Then
used(e9sub) = 1
edge(9) = Number(e9sub)
For e10sub = 2 To 12
If used(e10sub) = 0 Then
used(e10sub) = 1
edge(10) = Number(e10sub)
If edge(8) + edge(9) + edge(10) = eachVertex Then
For e11sub = 2 To 12
If used(e11sub) = 0 Then
used(e11sub) = 1
edge(11) = Number(e11sub)
If edge(11) + edge(3) + edge(10) = eachVertex Then
For subscr = 1 To 12
If used(subscr) = 0 Then
edge(12) = Number(subscr)
If edge(12) + edge(5) + edge(11) = eachVertex And edge(12) + edge(7) + edge(9) = eachVertex Then
For i = 1 To 12
Print edge(i);
Next
Print
End If
End If
Next
Open "c:\progra~1\devstudio\vb\projects\flooble\edge-numbered cube.txt" For Append As #2
Print #2, "GH CG FG DH HE CD DA BC AB BF EF AE"
For i = 1 To 12
Print #2, edge(i);
Next
Print #2, " "; total
Print #2, " D+-"; Right("0" + LTrim(Str(edge(6))), 2); "-+C"
Print #2, " | |"
Print #2, " "; Right("0" + LTrim(Str(edge(4))), 2); " "; Right("0" + LTrim(Str(edge(2))), 2)
Print #2, "D H| |G C"
Print #2, "+-"; Right("0" + LTrim(Str(edge(4))), 2); "-+-"; Right("0" + LTrim(Str(edge(1))), 2); "-+-"; Right("0" + LTrim(Str(edge(2))), 2); "-+"
Print #2, "| | | |"
Print #2, Right("0" + LTrim(Str(edge(7))), 2); " "; Right("0" + LTrim(Str(edge(5))), 2); " "; Right("0" + LTrim(Str(edge(3))), 2); " "; Right("0" + LTrim(Str(edge(8))), 2)
Print #2, "|A E| |F B|"
Print #2, "+-"; Right("0" + LTrim(Str(edge(12))), 2); "-+-"; Right("0" + LTrim(Str(edge(11))), 2); "-+-"; Right("0" + LTrim(Str(edge(10))), 2); "-+"
Print #2, " | |"
Print #2, " "; Right("0" + LTrim(Str(edge(12))), 2); " "; Right("0" + LTrim(Str(edge(10))), 2)
Print #2, " | |"
Print #2, " A+-"; Right("0" + LTrim(Str(edge(9))), 2); "-+B"
Print #2,
Close 2
goAhead = False
MousePointer = vbDefault
Do: DoEvents: Loop Until goAhead = True Or getOut = True
If getOut Then Exit Sub
MousePointer = vbHourglass
End If
used(e11sub) = 0
End If
Next e11sub
End If
used(e10sub) = 0
End If
Next e10sub
used(e9sub) = 0
End If
Next e9sub
End If
used(e8sub) = 0
End If
Next e8sub
End If
used(e7sub) = 0
End If
Next e7sub
used(e6sub) = 0
End If
Next e6sub
End If
used(e5sub) = 0
End If
Next e5sub
used(e4sub) = 0
End If
Next e4sub
End If
used(e3sub) = 0
Next e3sub
used(e2sub) = 0
Next e2sub
used(1) = 0
End If
Next n12
Next n11
Next n10
Next n9
Next n8
Next n7
Next n6
Next n5
Next n4
Next n3
Next n2
Next n1
Next
MousePointer = vbDefault
End Sub
Private Sub Command2_Click()
goAhead = True
End Sub
Private Sub Command3_Click()
getOut = True
End Sub
The program always places the lowest number in the top front edge, which is GH according to the puzzle statement and understanding the z-axis to be positive toward you.
The program also chooses CG to be smaller than FG, but that's the limit of the degree toward which trivial rotations and reflections are weeded out by the program. I weeded out other rotations/reflections by editing the output, leaving only those solutions where the lowest valued edge adjacent to GH is CG. There are six left, that are therefore non-trivial variations, with this lowest total, 80, with each vertex adding to 20.
Note in the diagrams that CG, DH, AE and BF are shown twice, as the faces they separate are split from one another.
GH CG FG DH HE CD DA BC AB BF EF AE
1 5 14 8 11 9 3 6 10 4 2 7 80
D+-09-+C
| |
08 05
D H| |G C
+-08-+-01-+-05-+
| | | |
03 11 14 06
|A E| |F B|
+-07-+-02-+-04-+
| |
07 04
| |
A+-10-+B
GH CG FG DH HE CD DA BC AB BF EF AE
1 5 14 9 10 8 3 7 11 2 4 6 80
D+-08-+C
| |
09 05
D H| |G C
+-09-+-01-+-05-+
| | | |
03 10 14 07
|A E| |F B|
+-06-+-04-+-02-+
| |
06 02
| |
A+-11-+B
GH CG FG DH HE CD DA BC AB BF EF AE
1 5 14 11 8 6 3 9 7 4 2 10 80
D+-06-+C
| |
11 05
D H| |G C
+-11-+-01-+-05-+
| | | |
03 08 14 09
|A E| |F B|
+-10-+-02-+-04-+
| |
10 04
| |
A+-07-+B
GH CG FG DH HE CD DA BC AB BF EF AE
1 6 13 7 12 4 9 10 8 2 5 3 80
D+-04-+C
| |
07 06
D H| |G C
+-07-+-01-+-06-+
| | | |
09 12 13 10
|A E| |F B|
+-03-+-05-+-02-+
| |
03 02
| |
A+-08-+B
GH CG FG DH HE CD DA BC AB BF EF AE
1 6 13 10 9 2 8 12 5 3 4 7 80
D+-02-+C
| |
10 06
D H| |G C
+-10-+-01-+-06-+
| | | |
08 09 13 12
|A E| |F B|
+-07-+-04-+-03-+
| |
07 03
| |
A+-05-+B
GH CG FG DH HE CD DA BC AB BF EF AE
1 7 12 9 10 8 3 5 13 2 6 4 80
D+-08-+C
| |
09 07
D H| |G C
+-09-+-01-+-07-+
| | | |
03 10 12 05
|A E| |F B|
+-04-+-06-+-02-+
| |
04 02
| |
A+-13-+B
|
Posted by Charlie
on 2008-03-19 18:41:48 |