New coins are being minted at n independent mints. There is a suspicion that some mints might use a variant material for the coins. There can only be one variant material: fake coins weigh the same independently of the mint. The weight of genuine coins is known, but the weight of fake coins is not. There is a machine that can precisely weigh any number of coins, but the machine can only be used twice. You can request several coins from each mint and then perform the two weighings so that you can deduce with certainty which mints produce fake coins and which mints produce real coins. What is the minimum total of coins you need to request from the mints?

I will follow ApSimon’s notation. Suppose Pr and Qr is the number of coins from the mint r used in the first and the second weighing correspondingly. That is, we are minimizing Σmax(Pr,Qr). (All my summations are over all the mints. I skip the summation limits because it is difficult to write math in html.) Let us denote by W the weight of the genuine coin and by W(1 + ε) the weight of the fake coin. We do not know ε, except that it is not zero.

Let dr be either 0 or 1, depending on what material the r-th mint uses. Thus, the coin from the r-th mint weighs W(1 + drε). We know the results of these two weighings and the weight of the genuine coin. Therefore, we can calculate the following two values: a = ΣPrdrε and b = ΣQrdrε.

It is clear that we need to request at least one coin from each mint and use it in at least one weighing: Pr + Qr > 0. If both sums a and b are zero, then all the mints are producing genuine coins. Neither of the two values gives us much information as we do not know ε. We can get rid of ε by dividing a by b.

There are 2n − 1 combinations of possible answers: these are subsets of the set of mints producing fake coins given that there is at least one. Thus we need to select numbers Pr and Qr, so that a/b produces 2n − 1 possible answers for different sets of values of dr.

Let us consider cases in which the total number of mints is small. If there is one mint we can take one coin and we won’t even need a second weighing. For two mints we need one coin from each mint for a total of 2. For three mints, one coin from each mint is not enough. I leave this statement as an exercise. It is possible to test three mints with four coins: one each from the first and second mints and two from the third mint. The coins from each mint for the first and second weighings are (0,1,2) and (1,1,0) respectively.

To prove that this works we need to calculate (d2 + 2d3)/(d1 + d2) for seven different combinations of dr. I leave this as an exercise.

This puzzle seems to be very difficult. We only know the answer if the number of mints is not more than seven. The corresponding sequence A007673 in the OEIS is: 1, 2, 4, 8, 15, 38, 74. It is possible to give bounds for this sequence, but they are so far apart. The lower bound is n. And the ApSimon’s book offers a construction for two weighings were Pr = r! and Qr = 1.

You can try to find a better construction, or you can try calculating more terms of the sequence. You can also read more about this problem in my short paper Attacking ApSimon’s Mints.

I do not want to leave the readers with the puzzle that might end up being intractable. So I suggest the following easy puzzle. Solve the ApSimon’s Mints problem assuming that the weight of the fake coin is known.

21 Comments

David Reynolds:

I believe that there’s a simpler solution.

Use one coin from each mint in the first weighing.
This yields the weight of a fake coin as well as the number of mints minting fake coins.

For the second weighing, use one coin from mint 1, two coins from mint 2, four coins from mint 3, … 2^n coins for mint n.
Let Ng = number of genuine coins.
Let Nf = number of fake coins.
Let Wt = total weight of second weighing.
Since we know W and W(1+e), we have two equations.

Eq 1. Ng * W + Nf * W(1+e) = Wt
Eq 2. Ng + Nf = 2^(n+1)-1

Equation 1 by itself could possibly be ambiguous. But both equations allow us to uniquely solve for Nf in the second weighing.
Express Nf as a binary value and the ‘1’ bits represent the mints that are minting fake coins.
Note that the number of ‘1’ bits must equal the number of mints minting fake coins that we determined in the first weighing.

This allows us to optimize further and not add any coins for the last mint.
After determining the number of ‘1’ bits, then we can know whether the last mint was minting genuine or fake coins.

David Reynolds:

David Reynolds:

In the case where the weight of the fake coins is known.
It is possible to determine the fraudulent mints in just one weighing.

1 coin from mint 1, 2 coins from mint 2, 4 coins from mint 3, … 2^(n-1) coins for mint n.
The weight discrepancy will tell us how many coins are fake and from that we can determine the mints responsible.

In two weighings, I do not see a method that improves on dividing the mints in half and testing each group disjointedly.

In the case where the weight of the fake coins is not known, I’ll offer my original posting restated.

First weighing: 1 coin from each mint.
Record the weight discrepancy. It doesn’t tell us anything, except in the case where the discrepancy is zero.

Second weighing:
1 coin from mint 1, 2 coins from mint 2, 4 coins from mint 3, … 2^(n-1) coins for mint n.
Again, check the weight discrepancy.
If it is unchanged, only mint 1 is fraudulent.
If it is doubled, only mint 2 is fraudulent.
If it is increased four fold, only mint 3 is fraudulent.
etc.
If it is multiplied by 5, both mints 1 and 4 are fraudulent.
It can easily be seen that the increase will be integral and the binary decomposition will uniquely yield the fraudulent mints.

The solution is not optimal. I only offer it as a general upper bound.

David Reynolds:

Konstantin:

I think, 38 and 74 aren’t optimal. So, they are must be excluded from OEIS A007673. My counterexample for n=6 is
P=(0,1,1,2,4,8) and Q=(9,6,1,1,1,1) -> sum = 9+6+1+2+4+8=30.
Can you check this my result?

David Reynolds:

A note concerning the general lower bound.
If r is the number of mints, and r > 1, the number of total coins must be >= ceiling(2^(r/2)).
This is easier to talk about for a discrete case. Let’s take 8 mints as an example.
There are 256 possible outcomes that we must identify with just two weighings, so we must have at least 256 distinct ratios of weight values. For instance, the first weighing might have 20 possible results and the second weighing might only have 13. 20 * 13 > 256. That will work if there aren’t many that reduce to similar ratios. The ideal case, however, would be when the distinct results from both weighing are almost equal. Since the square root of 256 is 16, it is sufficient to have just 16 distinct weight outcomes from each weighing (assuming we can find two sets that have no common ratios). So how many coins do we need to guarantee 16 distinct outcomes?
Let t be the total number of coins.
One outcome is that they are all genuine. weight = t * W(1).
One coin could be fake. weight = (t – 1) * W(1) + W(1 + e).
Two coins could be fake. weight = (t – 2) * W(1) + 2 * W(1 + e).
etc.
We must have at least 15 coins that could be fake to generate 16 distinct outcomes. And this is our minimal answer, 15 total coins.
And now for the second weighing. If we use all the same coins, the ratios will not be unique. If we leave one or more out, we cannot achieve 16 distinct outcomes. Therefore we must add at least 1 more coin to our overall set of coins that we can include in the second weighing. So we must have at least 16 coins, the square root of 2^8.
And in general, that is ceiling(2^(r/2)).
That is more than r, but still very low considering actual results that have been posted. The minimum number of coins to test 6 mints with this formula is 8, but the best case uses 29 coins!

David Reynolds:

Hmmm… There is a proof here, honest.
I’ll remove all less than and greater than signs and post again.

f(2^n-1) is less than f(2^(n-2))
(2^(n+3)-4n-8)/(3^(n+1)-2n-3) is less than (2^n-2)/(3^(n-1)-1)
(2^(n+3)-4n-8)*(3^(n-1)-1) is less than (2^n-2)*(3^(n+1)-2n-3)
O(2^(n+3)*3^(n-1)) is less than O((2^n)*3^(n+1))
divide both sides by 2^n*3^(n-1)
8 is less than 9

The first assertion holds all n larger than 1.

f(2^(n-1)) is greater than f(2^(n+2)-1)
(2^(n+1)-2)/(3^n-1) is greater than (2^(n+5)-4n-16)/(3^(n+3)-2n-7)
(2^(n+1)-2)*(3^(n+3)-2n-7) is greater than (2^(n+5)-4n-16)*(3^n-1)
O(2^(n+1)*3^(n+3)) is greater than O(2^(n+5)*3^n)
divide both sides by 2^(n+1)*3^n
27 is greater than 16

David Reynolds:

David Reynolds:

Concerning my general construction for ApSimon’s mints…

My reasoning for the technique to work for any arbitrary number of mints is that the ratios produced are all unique.
Each mint creates a range of ascending, unique ratios, and no two ranges can overlap.
I am confident that the ranges will never overlap.
However, the ranges aren’t strictly ascending.
This is evident even from the results I posted, starting at just 4 mints.
This raises the possibility that, given enough mints, a ratio may be duplicated within a single range.
I have verified my general construction for up to 25 mints and no duplication has appeared.
But infinity is very large and I must therefore retract my “proof”.