Weighing Piles of Coins

Source

I got this problem from Rustan Leino, who got it from Dave Detlefs, who read it in an MIT Alumni magazine. This puzzle is a bit more involved than most puzzles on this page, so you may want a paper and pen (and some tenacity) for this one. Once you get into it, though, it's a hard puzzle to put aside until you've solved it.

I solved it and wrote up my solution.

Problem    

There are two kinds of coins, genuine and counterfeit. A genuine coin weighs $X$ grams and a counterfeit coin weighs $X+\delta$ grams, where $X$ is a positive integer and delta is a real number satisfying $0 < |\delta| < 5.$ You're presented with 13 piles of 4 coins each. All of the coins are genuine, except for one pile, in which all 4 coins are counterfeit. You're given a precise scale (say, a digital scale capable of displaying any real number). Using it, you have to determine three things: $X,$ $\delta,$ and which pile contains the counterfeit coins. But, you're only allowed to use the scale twice! How can you do this?

Solution     Reveal