MadMolecule is correct. This problem appeared in one of the books of mathematical puzzles written by Martin Gardner that were published several decades ago when he was writing the "Mathematical Games" column for Scientific American.
Abusive comment hidden.
(Show it anyway.)