HardAttack wrote:Q.4.
Two perfect logicians, S and P, are told that integers x and y have been chosen such that 1 < x < y and x+y < 100. S is given the value x+y and P is given the value xy. They then have the following conversation.
P: I cannot determine the two numbers.
S: I knew that.
P: Now I can determine them.
S: So can I.
Given that the above statements are true, what are the two numbers?
The numbers are 4 and 13. I don't know how this could have been solved with just logic. My solution was not completely brute force, but it required a lot of excel calculations. I don't think I can adequately explain how I did it - even justifying the answer was pretty difficult.
First, I generated a list of all possible starting number combinations (there are 2304), and calculated the product and sum for each possible pair.
In another column, I added a count for the number of times each product appears in the list, and eliminated all S values for which there was a P value with only one possible set of factors.
From that list, I filtered out all combinations where a particular P value appeared more than once, and then filtered out all combinations where a particular S value appeared more than once.
The only remaining combination was S=17 and P=52, so the numbers are 4 and 13.
To confirm that this works:
4+13 = 17, which is given to S.
4*13 = 52, which is given to P.
1. There are two ways for P to have been given 52 (4*13, or 2*26), but he doesn’t know which, so he tells S that he cannot determine the numbers.
2. There are seven ways for S to have been given 17 (2+15, 3+14, …, 8+9). None of these pairs consist of two prime numbers, so S knows that P could not determine the numbers, and he tells this to P. (If P was given the product of two primes, then it would have been easy for him to factor it to determine the numbers.)
3. P knows that S was given either 17 or 28. If S was given 28, then some of the possible pairs (5+23, 11+17) consist of two primes, so S would not have known that P couldn’t determine the numbers. Therefore, S has 17, and P now knows that the numbers are 4 and 13, and tells S that.
4. S knows that P must have been given 30, 42, 52, 60, 66, 70 or 72. And since P was able to determine the numbers after eliminating one possibility, his number must have had only two possible sets of factors. Only 52 meets the criteria, so S now knows that the numbers are 4 and 13.