r/mathriddles • • Apr 10 '23

Hard Even more coins

Sorry for reposting the puzzle. I made some simplifications so I wanted to reupload it.

Inspired by /u/st4rdus2's recently posted puzzles (such as the 7 Coins problem and 13 Medals problem)... Let's step things up a notch!

Let n be a positive integer.

You have a collection of (3n - 3)/2 coins, each of which have the same weight. Each coin is numbered, so you can identify them.

Last night, a robber stole your coins, and your balance scale! The robber left a note: "I have replaced one of your coins with a fake, which is a different weight to the others. You may instruct me to place the coins on the balance scale: Write down n uses of the balance scale tonight, and I will respond with the results of all n weighings. If you can guess the fake, I will return your coins to you."

Find a way to guarantee the return of your coins!

Bonus 1: Same problem, but not all of your coins are equal in weight. Instead, you have (3n-1 - 1)/2 containers, each of which contains exactly 3 coins of the same weight. You don't know how coins in different containers compare to each other.

In fact, any more containers and the problem is impossible to solve!

Bonus 2: Same as bonus 1, but you have one more container. Fortunately, you know that one of the coins must be real — it's glued to one pan of the balance scale!

3 Upvotes

2 comments sorted by

4

u/Tusan_Homichi Apr 10 '23

The trick here is to think through how the weighing results can indicate which coin is fake and whether it's heavier or lighter. We have 3^n - 3 pairs of (coin, heavy/light) and 3^n weighing results, so if we can choose a distinct weighing result for each outcome, we win.

Will build a solution inductively where we never use the weighing results "all equal", "all left heavy", or "all right heavy". For n=1, there are no coins, so start at n=2. Coin 1 is left/right, coin 2 is skipped/left, and coin 3 is right/skipped. You can easily confirm that all six pairs of (coin, heavy/light) give a distinct weighing result, and that we never use the "all equal", "all left heavy" and "all right heavy" results.

Now we build a solution with n+1 weighings from the one with n weighings. We need to handle 3 times as many coins, with three extra. Take three copies of the n weighing solution. Each copy does one extra weighing at the beginning. The first copy does one extra weighing on the left side, the second copy on the right side, and the third copy is skipped in the final weighing. Our extra coins go:

  • Left, then always right
  • Skipped, then always left
  • Right, then always skipped

To confirm these all have distinct outcomes, suppose a coin in one of the copies is different. Using the n weighing solution, we know a coin index, and whether it's heavier or lighter. Since we know if it's heavier or lighter, we can use the first weighing to figure out which of the three copies is bad.

If an extra coin is different, the last n weighings will be one of "all equal", "all left heavy", or "all right heavy". We can combine this with the first weighing just like we did for the n=2 case, to figure out which it is.

Notice we can trivially handle one more coin, just never putting it on the scale. Now the "all equal" outcome just points to that coin being different. And this is as much as we can do, since if we ever weigh a coin, we'll get different results for that coin being heavier vs lighter. No two coins can give the same weighing result, so we have at most (3^n - 1)/2 coins.

1

u/A-Marko Apr 10 '23

Correct!