Twelve Coins Puzzle

In this Stock Puzzle, you are given a number of coins, or bags of coins, and a balance. You are told that one coin or bag is heavier or lighter than the others (in most versions of the puzzle, the odd-weight coins are counterfeit). Through a limited number of weighings, you must determine which coin or bag of coins is counterfeit.

The usual version is 12 coins (or bags, or whatever) with three weighings, which has several solutions, some more intuitive than others. It's easier if you know whether the counterfeits are heavier or lighter than the genuine coins, so in trickier versions of the puzzle you must figure this out as well. A third variation may give you 13 coins - the same solution that gives the odd weight will also work for this - simply leave the extra coin out, and then if it was the counterfeit, you'll figure that out in the three weighings. Thirteen coins and the unknown weight are not both possible in the standard three weighings.

If you know whether the bad coins are heavier or lighter, the solution is to divide the coins into three groups of four coins each. Weigh group A against Group B. If they are balanced, the bad coin is in group C. If they do not balance, the bad coin is on the side corresponding to the description of the bad coin. (If it is heavier, the heavier side contains the bad coin; if the bad coin is lighter, the lighter side contains it.) Now take the coins in the group known to contain the bad coin and weigh two against two. Again one side will be off in the same direction in which the coin is bad: The counterfeit coin is one of those two. Weigh those two coins against each other.

If the more complicated version is used, and whether the bad coin is heavier or lighter is not known, the procedure is a little different and more complicated.
 * Put four coins on each side. There are two possibilities:
 * 1. One side is heavier than the other. If this is the case, remove three coins from the heavier side, move three coins from the lighter side to the heavier side, and place three coins that were not weighed the first time on the lighter side. (Remember which coins are which.) There are three possibilities:
 * 1.a) The same side that was heavier the first time is still heavier. This means that either the coin that stayed there is heavier or that the coin that stayed on the lighter side is lighter. Balancing one of these against one of the other ten coins will reveal which of these is true, thus solving the puzzle.
 * 1.b) The side that was heavier the first time is lighter the second time. This means that one of the three coins that went from the lighter side to the heavier side is the light coin. For the third attempt, weigh two of these coins against each other. If one is lighter, it is the unique coin; if they balance, the third coin is the light one.
 * 1.c) Both sides are even. This means the one of the three coins that was removed from the heavier side is the heavy coin. For the third attempt, weigh two of these coins against each other: if one is heavier, it is the unique coin; if they balance, the third coin is the heavy one.
 * 2. Both sides are even. If this is the case, all eight coins are identical and can be set aside. Take the four remaining coins and place three on one side of the balance. Place 3 of the 8 identical coins on the other side. There are three possibilities:
 * 2.a) The three remaining coins are lighter. In this case you now know that one of those three coins is the odd one out and that it is lighter. Take two of those three coins and weigh them against each other. If the balance tips then the lighter coin is the odd one out. If the two coins balance then the third coin not on the balance is the odd one out and it is lighter.
 * 2.b) The three remaining coins are heavier. In this case you now know that one of those three coins is the odd one out and that it is heavier. Take two of those three coins and weigh them against each other. If the balance tips then the heavier coin is the odd one out. If the two coins balance then the third coin not on the balance is the odd one out and it is heavier.
 * 2.c) The three remaining coins balance. In this case you know that the unweighed coin is the odd one out. Weigh the remaining coin against one of the other 11 coins and this will tell you whether it is heavier or lighter.

There are other solutions, some of them with spiffy mnemonics, e.g. here and here

Another similar puzzle has you given a number of bags of coins and a mass measurement scale. The solution for this one involves taking one coin from bag A, two coins from bag B, etc., and figuring how how much the resulting measurement differs from what you would get if all the coins weighed the same.

Anime and Manga

 * The Kindaichi Case Files gives us this variant: ten bags of the same kind of coin, except one contains counterfeit, how many weighings does it take to determine which is fake?

Card Games

 * One Perplex City card has a variant, where you must figure out how to identify pills of a different weight from five jars in one weighing.

Literature

 * Used in With a Tangled Skein, in Piers Anthony's Incarnations of Immortality series. The heroine had to use this puzzle to find a certain soul disguised as a demon, out of the 12 demons.
 * It things resolve regardless.

Video Games

 * It appears using a spell that detects the power level of cubes in the Infocom game Spellbreaker; naturally, the spell can be used only three times.
 * Or only two times, if you, making the puzzle and the game Unwinnable.
 * Mentioned in Fire Emblem: The Sacred Stones, where Ewan presents this puzzle to Ross in a support conversation. However, in a slight twist, he doesn't ask how to do it in three weightings: he gives the more generic challenge of asking what is the minimum number of weighing required (and makes it 25 pebbles, not 12 coins). Ross immediately answers 24 (i.e., weighing the pebbles one by one), then after some encouragement from Ewan, answers 4. Close, but no cigar - interestingly, the answer is still 3.
 * Appears in a few different variants, usually involving weights rather than coins, in the Professor Layton series of games.
 * There is a similar puzzle in Drakensang 2 The River Of Time. In order to open a chest, you're given several iron and lead weights and you must put the right number of them in the four boxes around the altar. If you can't find the solution, you can ask the druid Megalesios to solve it for you, but you won't gain any experience.
 * Appears in the Jules Verne-inspired adventure game Voyage, where you have to isolate the lightest of twelve 'isotopes' in the fewest number of steps, with varying points available depending on which of the above solutions you use.