This puzzle begins with a familiar ring: you have a bag of visually indistinguishable, but not identical, coins. They are variously gold, silver and bronze, and therefore they are of three distinct weights. The King asks you to give him a gold coin.
You consider just drawing a coin at random, but you fear (correctly) that you will lose your head if the coin you give to the King is not gold. Being of above average intelligence, you cast about for a better approach.
You search the BrainDen archives for a balance scale. Luckily, you find one. Unluckily, it's damaged: Instead of giving the usual three outcomes, { <, +, > } it can discern only whether the two sides of the scale are in balance, or not. Whatever you place in the two pans can only be determined to have equal weight, or not.
But weight, there's more. The scale has a further idiosyncrasy. It will allow an object to be weighed only two times. If an object is weighed for a third time, the scale will magically cause the object to disappear.
That's it. The King is tapping his fingers impatiently on the table. There is no time to find another scale. If it heldps, I just looked in the bag and counted 1521 coins. I threw them all into a mass spectrometer that I just happened to have with me and determined that 827 of the coins are gold.
It's algorithm time. Can you fulfill the king's wishes using this really weird scale?