I have a batch of 16 coins, each coin weights either 9g, 10g, or 11g. I split the pile into halves and compare each half on a balance scale and the result is unequal.
Then I take each pile of 8 and perform the same process: split each pile in half and compare the halves from that pile. Both times I get unequal results.
I then repeat the process with the four piles of 4. Again all four weighings are unequal.
I keep going to make eight more weighings comparing the individual coins in each pair formed previously. Again all weighings are unequal.
What are the possible compositions of the original pile of 16 coins?
DefDbl A-Z
Dim crlf$, weight(16), solct, types$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
addOn 1
Do
ix = InStr(types, ",")
If ix Then
Text1.Text = Text1.Text & base$(Val(Left(types, ix - 1)), 17) & " "
End If
Text1.Text = Text1.Text & crlf
types = Mid(types, ix + 1)
Loop Until ix = 0
Text1.Text = Text1.Text & crlf & solct & " done"
End Sub
Sub addOn(wh)
For new1 = 9 To 11
weight(wh) = new1
good = 1
tst = wh: cpar = 1
Do While tst Mod 2 = 0
cp1 = 0: cp2 = 0
For i = 0 To cpar - 1
cp1 = cp1 + weight(wh - i)
cp2 = cp2 + weight(wh - i - cpar)
Next
If cp1 = cp2 Then good = 0: Exit Do
cpar = 2 * cpar
tst = tst / 2
Loop
If good Then
If wh = 16 Then
ct9 = 0: ct10 = 0: ct11 = 0
For i = 1 To 16
Select Case weight(i)
Case 9: ct9 = ct9 + 1
Case 10: ct10 = ct10 + 1
Case 11: ct11 = ct11 + 1
End Select
Next
encode$ = LTrim(Str(17 * 17 * ct9 + 17 * ct10 + ct11))
If InStr(types, encode) = 0 Then
types = types + encode + ","
End If
solct = solct + 1
Else
addOn wh + 1
End If
End If
Next new1
End Sub
Function base$(n, b)
v$ = ""
n2 = n
Do
d = n2 Mod b
n2 = n2 \ b
v$ = Mid("0123456789abcdefghijklmnopqrstuvwxyz", d + 1, 1) + v$
Loop Until n2 = 0
base$ = v$
End Function
Finds
655
565
556
98304 done
Meaning that there were 98,304 orderings of the coins in which this occurs (out of 3^16 = 43,046,721 possibilities). But, more importantly in answer to the question, all have six of one weight and five of each of the other two weights. Obviously not all cases of these compositions produce the given results, as sequence (ordering) matters, but these are the observed distributions of the three weights.
|
Posted by Charlie
on 2016-04-18 14:55:28 |