Here are some very close approximations to a full solution to this puzzle. I know that "close" only counts in horseshoes, but a lot of mathematics is approximations, like the value of pi. (Maybe I'll put that in the problem queue: "Find the exact value of pi".)
For distances not distinct:
Radius = 11
Points:
1: (11,0)
2: (5.5, 9.5)
3: (-5.5, 9.5)
4: (-11, 0)
5: (-5.5, -9.5)
6: (5.5, -9.5)
Distances between points:
1-2 11
1-3 19
1-4 22
1-5 19
1-6 11
2-3 11
2-4 19
2-5 22
2-6 19
3-4 11
3-5 19
3-6 22
4-5 11
4-6 19
5-6 11
For distinct distances:
Radius = 38.2
Points:
1: (38.2, 0)
2: (33.5, 18.4)
3: (-33.5, 18.4)
4: (6.8, -37.6)
5: (11.7, -36.4)
6: (17.2, -34.1)
Distances between points:
1-2 19
1-3 74
1-4 49
1-5 45
1-6 40
2-3 67
2-4 62
2-5 59
2-6 55
3-4 69
3-5 71
3-6 73
4-5 5
4-6 11
5-6 6
Revised Visual Basic program:
Imports System
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
Sub Main()
Randomize()
Dim strstarttime As String
Dim strendtime As String
Dim strend As String
Dim dblradius As Double
Dim intwork As Integer
Dim dblwork As Double
Dim dbltable(15) As Double
Dim dblcounter As Double = 0
Dim dbldistance12 As Double
Dim dbldistance13 As Double
Dim dbldistance14 As Double
Dim dbldistance15 As Double
Dim dbldistance16 As Double
Dim dbldistance21 As Double
Dim dbldistance23 As Double
Dim dbldistance24 As Double
Dim dbldistance25 As Double
Dim dbldistance26 As Double
Dim dbldistance34 As Double
Dim dbldistance35 As Double
Dim dbldistance36 As Double
Dim dbldistance45 As Double
Dim dbldistance46 As Double
Dim dbldistance56 As Double
Dim intpoints As Integer = 0
Dim dblx1 As Double
Dim dbly1 As Double
Dim dblx2 As Double
Dim dbly2 As Double
Dim dblx3 As Double
Dim dbly3 As Double
Dim dblx4 As Double
Dim dbly4 As Double
Dim dblx5 As Double
Dim dbly5 As Double
Dim dblx6 As Double
Dim dbly6 As Double
strstarttime = TimeOfDay
Console.WriteLine("Start of execution: " & strstarttime)
For index1 As Integer = 0 To 14
dbltable(index1) = 0
Next
dblradius = 11
While dblradius < 99999999 And intpoints < 6
dblradius += 0.1
dblwork = Int(dblradius * (10 ^ 2) + 0.5) / _
(10 ^ 2)
dblradius = dblwork
dblx1 = dblradius
dbly1 = 0
Console.WriteLine( _
TimeOfDay & ": Radius=" & Str(dblradius))
findpoints(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
strendtime = TimeOfDay
Console.WriteLine(" ")
Console.WriteLine("Start of execution: " & strstarttime)
strendtime = TimeOfDay
Console.WriteLine("End of execution: " & strendtime)
strend = "?"
Console.WriteLine(" ")
While strend <> "X"
Console.WriteLine("Please enter X to exit program...")
strend = UCase(Console.ReadLine())
End While
End Sub
Sub findpoints(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
Dim dblwork As Double
dblx2 = dblx1
While dblx2 > -dblradius
dblx2 -= 0.1
findy(dblradius, _
dblx2, dbly2)
For index1 As Integer = 0 To 14
dbltable(index1) = 0
Next
findpoint2(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
If intpoints < 6 Then
While dblx2 < dblradius
dblx2 += 0.1
findy(dblradius, _
dblx2, dbly2)
dbly2 *= -1
findpoint2(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
End Sub
Sub findpoint2(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
Dim dblwork As Double
Dim dblwork2 As Double
Dim dblincr As Double
If dblx2 = dblx1 And dbly2 = dbly1 Then
Exit Sub
End If
pointdistance(dblx1, dbly1, _
dblx2, dbly2, dbldistance12)
If dbldistance12 <> Fix(dbldistance12) Then
Exit Sub
End If
dbltable(0) = dbldistance12
dblx3 = dblx2
dbly3 = dbly2
If dbly3 > 0 Then
While dblx3 > -dblradius
dblx3 -= 0.1
findy(dblradius, _
dblx3, dbly3)
findpoint3(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
If intpoints < 6 Then
While dblx3 < dblradius
dblx3 += 0.1
findy(dblradius, _
dblx3, dbly3)
dbly3 *= -1
findpoint3(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
End Sub
Sub findpoint3(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
Dim dblwork As Double
Dim dblwork2 As Double
Dim dblincr As Double
If dblx3 = dblx1 And dbly3 = dbly1 Then
Exit Sub
End If
pointdistance(dblx1, dbly1, _
dblx3, dbly3, dbldistance13)
pointdistance(dblx2, dbly2, _
dblx3, dbly3, dbldistance23)
If dbldistance13 <> Fix(dbldistance13) Or _
dbldistance23 <> Fix(dbldistance23) Then
Exit Sub
End If
dbltable(1) = dbldistance13
dbltable(2) = dbldistance23
For index1 As Integer = 0 To 1
For index2 As Integer = index1 + 1 To 2
If dbltable(index1) = dbltable(index2) And _
dbltable(index1) <> 0 Then
Exit Sub
End If
Next
Next
dblx4 = dblx3
dbly4 = dbly3
If dbly4 > 0 Then
While dblx4 > -dblradius
dblx4 -= 0.1
findy(dblradius, _
dblx4, dbly4)
findpoint4(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
If intpoints < 6 Then
While dblx4 < dblradius
dblx4 += 0.1
findy(dblradius, _
dblx4, dbly4)
dbly4 *= -1
findpoint4(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
End Sub
Sub findpoint4(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
Dim dblwork As Double
Dim dblwork2 As Double
Dim dblincr As Double
If dblx4 = dblx1 And dbly4 = dbly1 Then
Exit Sub
End If
pointdistance(dblx1, dbly1, _
dblx4, dbly4, dbldistance14)
pointdistance(dblx2, dbly2, _
dblx4, dbly4, dbldistance24)
pointdistance(dblx3, dbly3, _
dblx4, dbly4, dbldistance34)
If dbldistance14 <> Fix(dbldistance14) Or _
dbldistance24 <> Fix(dbldistance24) Or _
dbldistance34 <> Fix(dbldistance34) Then
Exit Sub
End If
dbltable(3) = dbldistance14
dbltable(4) = dbldistance24
dbltable(5) = dbldistance34
For index1 As Integer = 0 To 4
For index2 As Integer = index1 + 1 To 5
If dbltable(index1) = dbltable(index2) And _
dbltable(index1) <> 0 Then
Exit Sub
End If
Next
Next
dblx5 = dblx4
dbly5 = dbly4
If dbly5 > 0 Then
While dblx5 > -dblradius
dblx5 -= 0.1
findy(dblradius, _
dblx5, dbly5)
findpoint5(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
If intpoints < 6 Then
While dblx5 < dblradius
dblx5 += 0.1
findy(dblradius, _
dblx5, dbly5)
dbly5 *= -1
findpoint5(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
End Sub
Sub findpoint5(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
Dim dblwork As Double
Dim dblwork2 As Double
Dim dblincr As Double
If dblx5 = dblx1 And dbly5 = dbly1 Then
Exit Sub
End If
pointdistance(dblx1, dbly1, _
dblx5, dbly5, dbldistance15)
pointdistance(dblx2, dbly2, _
dblx5, dbly5, dbldistance25)
pointdistance(dblx3, dbly3, _
dblx5, dbly5, dbldistance35)
pointdistance(dblx4, dbly4, _
dblx5, dbly5, dbldistance45)
If dbldistance15 <> Fix(dbldistance15) Or _
dbldistance25 <> Fix(dbldistance25) Or _
dbldistance35 <> Fix(dbldistance35) Or _
dbldistance45 <> Fix(dbldistance45) Then
Exit Sub
End If
dbltable(6) = dbldistance15
dbltable(7) = dbldistance25
dbltable(8) = dbldistance35
dbltable(9) = dbldistance45
For index1 As Integer = 0 To 8
For index2 As Integer = index1 + 1 To 9
If dbltable(index1) = dbltable(index2) And _
dbltable(index1) <> 0 Then
Exit Sub
End If
Next
Next
dblx6 = dblx5
dbly6 = dbly5
If dbly6 > 0 Then
While dblx6 > -dblradius
dblx6 -= 0.1
findy(dblradius, _
dblx6, dbly6)
findpoint6(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
If intpoints < 6 Then
While dblx6 < dblradius
dblx6 += 0.1
findy(dblradius, _
dblx6, dbly6)
dbly6 *= -1
findpoint6(dblradius, intpoints, dblcounter, _
dblx1, dbly1, dblx2, dbly2, _
dblx3, dbly3, dblx4, dbly4, _
dblx5, dbly5, dblx6, dbly6, _
dbldistance12, dbldistance13, _
dbldistance14, dbldistance15, _
dbldistance16, dbldistance23, _
dbldistance24, dbldistance25, _
dbldistance26, dbldistance34, _
dbldistance35, dbldistance36, _
dbldistance45, dbldistance46, _
dbldistance56, dbltable)
End While
End If
End Sub
Sub findpoint6(ByRef dblradius, ByRef intpoints, _
ByRef dblcounter, _
ByRef dblx1, ByRef dbly1, ByRef dblx2, ByRef dbly2, _
ByRef dblx3, ByRef dbly3, ByRef dblx4, ByRef dbly4, _
ByRef dblx5, ByRef dbly5, ByRef dblx6, ByRef dbly6, _
ByRef dbldistance12, ByRef dbldistance13, _
ByRef dbldistance14, ByRef dbldistance15, _
ByRef dbldistance16, ByRef dbldistance23, _
ByRef dbldistance24, ByRef dbldistance25, _
ByRef dbldistance26, ByRef dbldistance34, _
ByRef dbldistance35, ByRef dbldistance36, _
ByRef dbldistance45, ByRef dbldistance46, _
ByRef dbldistance56, ByRef dbltable)
If dblx6 = dblx1 And dbly6 = dbly1 Then
Exit Sub
End If
pointdistance(dblx1, dbly1, _
dblx6, dbly6, dbldistance16)
pointdistance(dblx2, dbly2, _
dblx6, dbly6, dbldistance26)
pointdistance(dblx3, dbly3, _
dblx6, dbly6, dbldistance36)
pointdistance(dblx4, dbly4, _
dblx6, dbly6, dbldistance46)
pointdistance(dblx5, dbly5, _
dblx6, dbly6, dbldistance56)
If dbldistance16 <> Fix(dbldistance16) Or _
dbldistance26 <> Fix(dbldistance26) Or _
dbldistance36 <> Fix(dbldistance36) Or _
dbldistance46 <> Fix(dbldistance46) Or _
dbldistance56 <> Fix(dbldistance56) Then
Exit Sub
End If
dbltable(10) = dbldistance16
dbltable(11) = dbldistance26
dbltable(12) = dbldistance36
dbltable(13) = dbldistance46
dbltable(14) = dbldistance56
For index1 As Integer = 0 To 13
For index2 As Integer = index1 + 1 To 14
If dbltable(index1) = dbltable(index2) And _
dbltable(index1) <> 0 Then
Exit Sub
End If
Next
Next
intpoints = 6
Console.WriteLine("Eureka !!!!")
Console.WriteLine("Radius=" & Str(dblradius))
Console.WriteLine("The six points are:")
Console.WriteLine( _
"(" & Str(dblx1) & "," & Str(dbly1) & ")")
Console.WriteLine( _
"(" & Str(dblx2) & "," & Str(dbly2) & ")")
Console.WriteLine( _
"(" & Str(dblx3) & "," & Str(dbly3) & ")")
Console.WriteLine( _
"(" & Str(dblx4) & "," & Str(dbly4) & ")")
Console.WriteLine( _
"(" & Str(dblx5) & "," & Str(dbly5) & ")")
Console.WriteLine( _
"(" & Str(dblx6) & "," & Str(dbly6) & ")")
Console.WriteLine("Distances:")
Console.WriteLine( _
"Points 1-2: " & Str(dbldistance12))
Console.WriteLine( _
"Points 1-3: " & Str(dbldistance13))
Console.WriteLine( _
"Points 1-4: " & Str(dbldistance14))
Console.WriteLine( _
"Points 1-5: " & Str(dbldistance15))
Console.WriteLine( _
"Points 1-6: " & Str(dbldistance16))
Console.WriteLine( _
"Points 2-3: " & Str(dbldistance23))
Console.WriteLine( _
"Points 2-4: " & Str(dbldistance24))
Console.WriteLine( _
"Points 2-5: " & Str(dbldistance25))
Console.WriteLine( _
"Points 2-6: " & Str(dbldistance26))
Console.WriteLine( _
"Points 3-4: " & Str(dbldistance34))
Console.WriteLine( _
"Points 3-5: " & Str(dbldistance35))
Console.WriteLine( _
"Points 3-6: " & Str(dbldistance36))
Console.WriteLine( _
"Points 4-5: " & Str(dbldistance45))
Console.WriteLine( _
"Points 4-6: " & Str(dbldistance46))
Console.WriteLine( _
"Points 5-6: " & Str(dbldistance56))
Console.WriteLine("Please press enter to continue.")
Console.ReadLine()
End Sub
Sub findy(ByRef dblradius, _
ByRef dblx, ByRef dbly)
Dim dblwork As Double
dblwork = Int(dblx * (10 ^ 1) + 0.5) / _
(10 ^ 1)
dblx = dblwork
dbly = Sqrt((dblradius ^ 2) - (dblx ^ 2))
If Double.IsNaN(dbly) Then
dbly = 0
End If
dblwork = Int(dbly * (10 ^ 1) + 0.5) / _
(10 ^ 1)
dbly = dblwork
End Sub
Sub pointdistance(ByRef dblxa, ByRef dblya, _
ByRef dblxb, ByRef dblyb, ByRef dbldistance)
Dim dblwork As Double
dblwork = _
((dblxa - dblxb) ^ 2) + ((dblya - dblyb) ^ 2)
dbldistance = Sqrt(dblwork)
If Double.IsNaN(dbldistance) Then
dbldistance = 0
End If
dblwork = Int(dbldistance * (10 ^ 1) + 0.5) / _
(10 ^ 1)
dbldistance = dblwork
End Sub
End Module