This trick seems to have been invented independently by Martin Gardner and Karl Fulves. A blindfolded magician asks a spectator to lay three pennies on a table, in any arrangement of heads and tails. The magician’s goal is to put all three coins into the same state, all heads or all tails.
If the three coins already match, then the trick is done. If not, then the magician gives three instructions: Flip the left coin, flip the middle coin, flip the left coin. After each step he asks whether the three coins now match. By the third flip, they will.
“It’s no surprise that the magician can eventually equalize all the coins,” writes MIT computer scientist Erik Demaine, “but it’s impressive that it always takes at most three moves.” The technique exploits a principle used in Gray codes, which are used to reduce errors when using analog signals to represent digital data. Demaine relates a similar trick involving four coins in the November-December 2010 issue of American Scientist.