Originally posted by The Plumber
In that case, the answer is 4 & 13, and that's the only solution.
I agree with that answer, but there must be a better method to reach the solution than the one I used.
Perhaps one of you smart guys can explain the logic that best solves the problem.
My reasoning went as follows:
1) When PRODUCT says "I don't know n1 or n2", I know n1 and n2 are not both prime numbers.
2) When SUM says "I knew you didn't know n1 or n2", I know that the sum can't be reached by adding prime + prime. I eliminate all sums with this possibility. I now have a list of 'acceptable sums' (11, 17, 23, 27, 29, etc.).
3) When PRODUCT says "I now know n1 and n2", he knows about the acceptable sums. I know that out of all his candidate n1 and n2 combinations, only one of them adds to an acceptable sum. He was able to eliminate all the other sums, thus giving him n1 and n2.
4) Now comes the hard part. SUM claims to "now know n1 and n2". He must have deduced the product somehow. Can he do it for (2,9)? No, because with the information he has, he only knows the product is either 18, 24, 28, or 30. Break 18 down into potential sums and you get 2+9 and 3+6. One acceptable, one not. However, 24 also satisfies the criteria (leads to sums of 2+12, 3+8 and 4+6, and only one, 3+8, is acceptable). So a product of either 18 or 24 would allow the PRODUCT guy to make his deduction in Step 3, but the SUM guy still can't tell which product is valid.
So I must eliminate all sums that lead to the above scenario. Only one potential product must lead back to only acceptable sum! That's why (4, 13) works--it leads back to sums of 17 and 28 (one acceptable, one not)--and all other potential products based on a sum of 17 do not.
To prove that this is the only solution (crucial, or neither one could know what n1 and n2 are!), I wrote a program to do all this summing and factoring all the way up to (99, 99). Sure enough, (4, 13) is the only answer it finds.
[b]There must be an easier way![b]