The so-called “impossible puzzle” (also known as the “sum and product” puzzle) has been kicking around since 1969. It isn’t actually all that hard, but the statement of the puzzle can make it seem intractable when first encountered:
Consider a pair of integers X and Y such that 1 < X < Y and X+Y < 100.
P and S are mathematicians, who know the above constraints and who won’t deliberately lie.
In secret, P is told only the product X*Y and S is told only the sum X+Y.
P: “I can’t find the numbers.”
S: “I knew you couldn’t.”
P: “Then I know the numbers.”
S: “Then I do, too.”
Find X and Y.
Note that there are spoilers after the jump. Please read no further should you wish to attempt a solution on your own.
There is a lovely counterintuitive subtlety about the problem which fooled none other than the esteemed Martin Gardner (of Scientific American’s Mathematical Games fame). In the December, 1979 issue he included a “simplified” version of the problem with an upper bound of X≤20 and Y≤20.
This turns out to make the problem unsolvable, unless you are willing to resort to some extremely creative interpretation of the problem statement. Gardner added a correction at the end of his column in the March, 1980 issue. (I suppose if people are still talking about your subtle errors over 30 years later, that counts as fame.)
In any case, if you know a little number theory and/or are reasonably clever, you can work out a solution to the (correctly-stated version of the) problem using pencil and paper, in a few minutes.
If, like me, you’re not that clever and don’t know Goldbach’s conjecture from a plate of chips, you can still solve it. It turns out that, as with so many things in life, a combination of brute force and Perl gets the job done.
See the code for yourself: (4K Perl script)
An amusing diversion. (Moreso than watching people argue about the Monty Hall problem because they’re starting from different statements of the problem, or are innumerate, or both. That’s much more interesting from the standpoint of psychology than math.)