Number Square Mystery
Look at this number pattern:
1---2---3
4---5---6
7---8---9
Your job, should you decide to accept it:
Rearrange the numbers such that the sum of every number immediately adjacent to each number is a multpile of the number.
For instance:
Look at 7 ... numbers immediately adjacent are 4, 5, and 8 ... their sum is 17 ... certainly not a multiple of 7. FYI ... I do not have the solution, so I will be solving with you.
1---2---3
4---5---6
7---8---9
Your job, should you decide to accept it:
Rearrange the numbers such that the sum of every number immediately adjacent to each number is a multpile of the number.
For instance:
Look at 7 ... numbers immediately adjacent are 4, 5, and 8 ... their sum is 17 ... certainly not a multiple of 7. FYI ... I do not have the solution, so I will be solving with you.





14 Comments:
This post has been removed by a blog administrator.
Hi Zaux. Please post an explanation for the Robbers problem. Thanks.
ok
Hi Zaux, sorry off-topic again. But would you clarify the "Odd Streak of Heads" problem also? Thanks again.
Hi Chris ... it's posted.
Could it be this?
2 6 5
7 3 1
9 8 4
4 5 8
1 2 9
6 3 7
I think.....
Karl
Oops, misread the instructions - I got it wrong....
Hi Ragknot, that certainly works ... I wonder if there are other solutions.
Hi Karl ... your 9 and 3 position don't work. Numbers surrounding 9, total 25, not a multiple of 9. Numbers surrounding 3, total 25, not a multiple of 3.
Sorry Karl, I posted before seeing your correction.
Other solutions?
You could rotate the square 90 deg for a similar layout.
I don't know about completely arrangements.
There are eight different solutions
but all are either rotated or "flipped". For each solution, the neighbors of a number are the same.
For example, 2 always have the neighbors of 6, 3 and 7 so it has a neighbor sum of 10.
2 6 5
7 3 1
9 8 4
2 7 9
6 3 8
5 1 4
4 1 5
8 3 6
9 7 2
4 8 9
1 3 7
5 6 2
5 1 4
6 3 8
2 7 9
5 6 2
1 3 7
4 8 9
9 7 2
8 3 6
4 1 5
9 8 4
7 3 1
2 6 5
Wow ragknot ... that pretty well nails it.
Sub mseq9()
'9 digit sequences
'Solution: 1 Time= 0.999999605119228 Seconds
'265
'731
'984
'Solution: 2 Time= 0.999999605119228 Seconds
'279
'638
'514
'Solution: 3 Time= 0.999999605119228 Seconds
'415
'836
'972
'Solution: 4 Time= 0.999999605119228 Seconds
'489
'137
'562
'Solution: 5 Time= 0.999999605119228 Seconds
'514
'638
'279
'Solution: 6 Time= 0.999999605119228 Seconds
'562
'137
'489
'Solution: 7 Time= 1.99999983888119 Seconds
'972
'836
'415
'Solution: 8 Time= 1.99999983888119 Seconds
'984
'731
'265
Dim a, b, c, d, e, f, g, h, i As Integer
Dim row As Long
Dim sq As String
time1 = Now()
For a = 1 To 9
col = col + 1: row = 0
For b = 1 To 9
If b = a Then GoTo NXB
For c = 1 To 9
If c = a Then GoTo NXC
If c = b Then GoTo NXC
For d = 1 To 9
If d = a Then GoTo NXD
If d = b Then GoTo NXD
If d = c Then GoTo NXD
For e = 1 To 9
If e = a Then GoTo NXE
If e = b Then GoTo NXE
If e = c Then GoTo NXE
If e = d Then GoTo NXE
For f = 1 To 9
If f = a Then GoTo NXF
If f = b Then GoTo NXF
If f = c Then GoTo NXF
If f = d Then GoTo NXF
If f = e Then GoTo NXF
For g = 1 To 9
If g = a Then GoTo NXG
If g = b Then GoTo NXG
If g = c Then GoTo NXG
If g = d Then GoTo NXG
If g = e Then GoTo NXG
If g = f Then GoTo NXG
For h = 1 To 9
If h = a Then GoTo NXH
If h = b Then GoTo NXH
If h = c Then GoTo NXH
If h = d Then GoTo NXH
If h = e Then GoTo NXH
If h = f Then GoTo NXH
If h = g Then GoTo NXH
i = 45 - a - b - c - d - e - f - g - h
gotit = baffsquare(a, b, c, d, e, f, g, h, i)
If gotit Then
sol = sol + 1
Debug.Print "Solution:"; sol; " Total Time="; (Now() - time1) * 24 * 60 * 60; "Seconds"
Debug.Print a & b & c
Debug.Print d & e & f
Debug.Print g & h & i
End If
NXH: Next h
NXG: Next g
NXF: Next f
NXE: Next e
NXD: Next d
NXC: Next c
NXB: Next b
NXA: Next a
End Sub
Function baffsquare(a, b, c, d, e, f, g, h, i) As Boolean
SA = b + e + d
SB = a + d + e + f + c
SC = b + e + f
SD = a + b + e + h + g
SE = a + b + c + d + f + g + h + i
SF = c + b + e + h + i
SG = d + e + h
SH = g + d + e + f + i
SI = h + e + f
If SA Mod a = 0 Then
If SB Mod b = 0 Then
If SC Mod c = 0 Then
If SD Mod d = 0 Then
If SE Mod e = 0 Then
If SF Mod f = 0 Then
If SG Mod g = 0 Then
If SH Mod h = 0 Then
If SI Mod i = 0 Then
baffsquare = True
Exit Function
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Function
Post a Comment
Links to this post:
Create a Link
<< Home