The Four Numbers Game is a mathematical game, as taught by Dr. Paul Sally, Prof. of Mathematics at the University of Chicago. To play this game, draw a square and put a number at each corner, thus:
5___9 | | | | | | 7___13
Now form a new square based on the difference between each the values at the ends of each side. Example:
5_4_9 | | 2 4 | | 7_6_13
This gives a new square, which I'll rotate anticlockwise 45 degrees.
4___4 | | | | | | 2___6
This in turn gives
0___2 | | | | | | 2___4
Then
2___2 | | | | | | 2___2
Then
0___0 | | | | | | 0___0
At this point, the game is over.
Codes for geting any four given numbers:
- Sub FourNumbers(ByRef steps As String, ByRef count As Long, ParamArray s())
- Dim temp As String, tempcount As Long
- count = 1
- If s(0) & s(1) & s(2) & s(3) = "0000" Then steps = Join(s, ","): Exit Sub
- FourNumbers temp, tempcount, Abs(s(0) - s(1)), Abs(s(1) - s(2)), Abs(s(2) - s(3)), Abs(s(3) - s(0))
- steps = Join(s, ",") & vbCrLf & temp
- count = tempcount + 1
- End Sub
- Sub Getit()
- Dim steps As String, count As Long
- FourNumbers steps, count, [exp(1)], [pi()], 1, 0
- Debug.Print "Count=" & count & vbCrLf & String(50, "-") & vbCrLf & steps
- FourNumbers steps, count, 149, 274, 504, 927
- Debug.Print "Count=" & count & vbCrLf & String(50, "-") & vbCrLf & steps
- End Sub
It returns:
Count=5
--------------------------------------------------
2.71828182845905,3.14159265358979,1,0
0.423310825130748,2.14159265358979,1,2.71828182845905
1.71828182845905,1.14159265358979,1.71828182845905,2.2949710033283
0.576689174869252,0.576689174869252,0.576689174869252,0.576689174869252
0,0,0,0
Count=19
--------------------------------------------------
149,274,504,927
125,230,423,778
105,193,355,653
88,162,298,548
74,136,250,460
62,114,210,386
52,96,176,324
44,80,148,272
36,68,124,228
32,56,104,192
24,48,88,160
24,40,72,136
16,32,64,112
16,32,48,96
16,16,48,80
0,32,32,64
32,0,32,64
32,32,32,32
0,0,0,0