You have been given a certain number of coins that all look identical. All are made out of gold and weigh the same except for one counterfeit which weighs differently than all the rest. Your task is to pick out the counterfeit by weighing different coins against each other using a balance scale. You are only allowed eight weighings on the balance scale and you don't know whether the counterfeit coin is lighter or heavier than the rest.
What is the maximum possible number of coins for which you are guaranteed to be able to find the counterfeit?
It was previously asked by John Ross (https://brilliant.org/problems/counterfeit-coin/) but I add the number of weighing to complicate the problem.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let's solve the more general problem of having n weighings, to find out the maximum number of coins so that we can still identify which coin is the counterfeit (but we don't need to identify whether the counterfeit coin is heavier or lighter).
For each weighing, there could be three possible results: left-heavy, right-heavy, or balanced. Let's assign the value 1 to left-heavy, 2 to right-heavy, and 0 to balanced. Then let's consider the ternary number formed by the sequence of weighing results. For example, if in three weighings we have left-heavy, right-heavy, and right-heavy, then the corresponding number is 1 2 2 . Clearly, there are 3 n possible ternary numbers given n weighings. For example for n = 3 we have: 0 0 0 , 0 0 1 , 0 0 2 , 0 1 0 , 0 1 1 , 0 1 2 , 0 2 0 , 0 2 1 , 0 2 2 , 1 0 0 , 1 0 1 , 1 0 2 , 1 1 0 , 1 1 1 , 1 1 2 , 1 2 0 , 1 2 1 , 1 2 2 , 2 0 0 , 2 0 1 , 2 0 2 , 2 1 0 , 2 1 1 , 2 1 2 , 2 2 0 , 2 2 1 , 2 2 2 .
Now, let's consider the case when we know that the counterfeit is definitely heavier. We can then assign a number to each coin, and based on the ternary representation of the number, at the i -th weighing, we put the coin on the left-pan if the i -th digit (or more accurately: trit) is 1, on the right-pan if the i -th digit is 2, and do not weigh it if the i -th digit is 0. Note that this system will result in the same number of coins in each pan for each weighing, since for each coin there will be its symmetry assigned on the opposite pan in all weighings. This is important, as if there are different number of coins in the left and right pans, then it will never be balanced. Now, each weighing sequence will then correspond to a coin, and we can identify the coin simply by looking at the ternary number formed by the weighing sequence. So in this case we can weigh at maximum 3 n coins.
Now, coming back to the case where we don't know whether the counterfeit is heavier or lighter. Since we do not know whether placing a coin on the left-pan will yield left-heavy or right-heavy, we cannot assign a ternary number and its symmetry (by interchanging 1 and 2) to different coins. For example, if coin c 1 is given the number 1 1 2 and coin c 2 the number 2 2 1 , and the weighing result is 1 1 2 , we won't be able to distinguish whether it is because coin c 1 is counterfeit and heavier, or because coin c 2 is counterfeit and lighter. Therefore, we need to assign two ternary numbers for each coin, a number and its symmetry (note that sequence of all zeros do not have a symmetry), and we can pick either of them as the placement configuration for that coin. Now, if we use all the 3 n numbers, each trit will appear 3 n − 1 times. But this is an odd number, and therefore will not lead to the same number of coins for each weighing. So we need to remove at least one number (and its symmetry) and it should have at least one non-zero trit. This left us with at most 3 n − 2 numbers. Since the ternary number 0 does not have a symmetry, we have 3 n − 3 numbers with symmetry, plus the ternary number 0. So in total we can have at most 2 3 n − 3 + 1 coins.
Now the problem reduces to the question of whether we can assign the numbers in a way that we always have the same number of coins on the left and right pans at each weighing. This is left as an exercise for the readers.
Given this formula, plugging in n = 8 gives us: 2 3 8 − 3 + 1 = 3 2 8 0 .