Another  Magic of Logic

Another Magic of Logic

Posers and Puzzles

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.

rs

H. T. & E. hte

Joined
21 May 04
Moves
3510
21 Dec 04
1 edit

n1 and n2 are two positive integers each less than 100. Mr.SUM knows the sum of n1 & n2, and Mr. PRODUCT knows their pruduct. Here is a conversation between them.
PRODUCT - I know the product of n1 and n2 , but I neither know n1
nor n2.
SUM - I know their sum and I knew that you don't know n1 and n2.
PRODUCT - I see. Now I know n1 as well as n2.
SUM - That being so, now I too know n1 as well as n2.
SUM and PRODUCT found out n1 and n2 in the course of this small conversation. Can you ?

c

Joined
31 Oct 04
Moves
2047
21 Dec 04

Originally posted by ranjan sinha
n1 and n2 are two positive integers each less than 100. Mr.SUM knows the sum of n1 & n2, and Mr. PRODUCT knows their pruduct. Here is a conversation between them.
PRODUCT - I know the product of n1 and n2 , but I neither know n1
nor n2.
SUM - I know their sum and I knew that you don't know n1 and n2.
...[text shortened]... SUM and PRODUCT found out n1 and n2 in the course of this small conversation. Can you ?
Is the data sufficient? And do you know the answer?

rs

H. T. & E. hte

Joined
21 May 04
Moves
3510
21 Dec 04

Originally posted by coolwarrior
Is the data sufficient? And do you know the answer?
Yes to both.

TP
Leak-Proof

under the sink

Joined
08 Aug 04
Moves
12493
21 Dec 04
1 edit

Originally posted by ranjan sinha
n1 and n2 are two positive integers each less than 100. Mr.SUM knows the sum of n1 & n2, and Mr. PRODUCT knows their pruduct. Here is a conversation between them.
PRODUCT - I know the product of n1 and n2 , but I neither ...[text shortened]... out n1 and n2 in the course of this small conversation. Can you ?
1 & 4 - if I have properly understood the question. It would have been more interesting (and possibly have more than one solution if you said n1 & n2 had to be greater than 1)

Mr. P knows the product is 4, but doesn't know if the combination is 1,4 or 2,2.
Mr. S knows the sum is 5 and knows that there are two possible combinations, 1,4 and 2,3. In either case, the product would not be sufficient to deduce the numbers since 4 could be factored as 1,4 or 2,2 and 6 as 1,6 or 2,3. Hence Mr. S knows that Mr. P doesn't know n1 & n2.
Once Mr. P discovers that Mr. S knows he doesn't have a solution he does the following computation. "If n1 & n2 were 2,2, Mr. S would know the sum as 4, and would know of two possible combinations, 1,3 and 2,2. If n1 & n2 were 1,3, then the product would be 3, and I would know n1 & n2. Hence the sum is not 4, and n1 & n2 are not 2,2.
Therefore n1 & n2 are 1,4."
Once Mr. P states that he now knows n1 & n2, Mr. S can perform a similar deduction and come to the same conclusion.

I haven't proved that this is the only combination that works, but I'm assuming it is, because the possible solutions quickly go up as the numbers get larger, and I don't think you can narrow down to the solution.

rs

H. T. & E. hte

Joined
21 May 04
Moves
3510
22 Dec 04
1 edit

Each of n1 and n2 being greater than unity was also an essential condition. Thank you for pointing out and I apologise for missing to mention this in the original statement of the puzzle. And yes, 1 & 4 is obviously not the answer.

TP
Leak-Proof

under the sink

Joined
08 Aug 04
Moves
12493
23 Dec 04

Originally posted by ranjan sinha
Each of n1 and n2 being greater than unity was also an essential condition. Thank you for pointing out and I apologise for missing to mention this in the original statement of the puzzle. And yes, 1 & 4 is obviously not the answer.
In that case, the answer is 4 & 13, and that's the only solution.

Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
23 Dec 04

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]

TP
Leak-Proof

under the sink

Joined
08 Aug 04
Moves
12493
23 Dec 04
1 edit

Originally posted by BigDoggProblem
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.
That's similar to the reasoning I used. I used a spreadsheet, not a program, but deduced the answer in the same manner. I'll leave it to the truly smart folks here to simplify it.

Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
24 Dec 04

Originally posted by The Plumber
That's similar to the reasoning I used. I used a spreadsheet, not a program, but deduced the answer in the same manner. I'll leave it to the truly smart folks here to simplify it.
I'm surprised a spreadsheet would work - I mean, you don't know how many factors any given number will have, so how much room do you leave for everything? Do you just make everything so big that even 99+99 fits?

C

Joined
30 Oct 04
Moves
2295
25 Dec 04

Originally posted by BigDoggProblem
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' ...[text shortened]... 99, 99). Sure enough, (4, 13) is the only answer it finds.

[b]There must be an easier way![b]
Your approach seems to be the only and the correct approach. I don't think there can be any analytical approach to tackle this problem.
However , since you have used a computer search, it would be interesting if any other solution is available if we search up to the (999,999).

Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
26 Dec 04

Originally posted by CoolPlayer
Your approach seems to be the only and the correct approach. I don't think there can be any analytical approach to tackle this problem.
However , since you have used a computer search, it would be interesting if any other solution is available if we search up to the (999,999).
I believe my approach is correct, but inelegant. Anyway, out of sheer curiousity, I tried what you suggested and had my program search up to (999, 999). It found several solutions: (4, 13); (4, 61); (16,73); (16, 111); (32, 131); (32, 311) etc.

The first three solutions are within the 2-99 range of the original problem! What's going on here? At first it looks like a programming error, but closer examination shows why (4, 61) is now a solution. 4+61 = 65. Another way to get 65 is 7+58. 7*58=406. Factor 406 and you get 2*7*29. This means we can only get 406 by 2*203, 7*58 or 14*29. 2+203=205 (acceptable); 7+58=65 (acceptable); 14+29=43 (not acceptable). However, the first sum (205) can't be reached with n1 and n2 both less than 100. So, in the original version of the problem, it is not acceptable.

The bottom line is that the PRODUCT guy must now consider potential sums above 198 (even if the real sum is not above 198), and that changes the reasoning entirely.

C

Joined
30 Oct 04
Moves
2295
28 Dec 04
1 edit

Originally posted by BigDoggProblem
I believe my approach is correct, but inelegant. Anyway, out of sheer curiousity, I tried what you suggested and had my program search up to (999, 999). It found several solutions: (4, 13); (4, 61); (16,73); (16, 111); (32, 131); (32 ...[text shortened]... al sum is not above 198), and that changes the reasoning entirely.
(4,61) does not seem to be a correct answer. (4,61) does not seem to satisfy the last condition i.e. the second response of Mr. SUM, viz.
" That being so, now I too know n1 as well as n2."
SUM declares this without PRODUCT disclosing his discovered knowledge to SUM.

Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
28 Dec 04

Originally posted by CoolPlayer
(4,61) does not seem to be a correct answer.
Why not? Please be a bit more specific.

Immigration Central

tinyurl.com/muzppr8z

Joined
23 Aug 04
Moves
26675
28 Dec 04

Originally posted by BigDoggProblem
Why not? Please be a bit more specific.
He was specific.

(4,61) does not seem to satisfy the last condition i.e. the second response of Mr. SUM, viz.
" That being so, now I too know n1 as well as n2."
SUM declares this without PRODUCT disclosing his discovered knowledge to SUM.

Secret RHP coder

on the payroll

Joined
26 Nov 04
Moves
155080
28 Dec 04

Originally posted by BigDoggProblem
4+61 = 65. Another way to get 65 is 7+58. [/b]
Oops-I lost the thread there. The 7+58 case has nothing to do with it. The logic is complicated -- it's easy to lose track of why you did what you did!

(4,61) is now a solution (if you can even call it that, because having multiple solutions means there is no solution!) because sums of 874 or greater are now possible. 19+46 = 65. 19*46 = 874. 874 = 2*19*23. 2+(19*23) = 439, (2*19)+23 = 61, (2*23)+19 = 65. 439 and 65 are acceptable sums; 61 is not. So once I allow n1 and n2 to go up to (437, 437), the problem is no longer sound. Mr. PRODUCT would not have been able to tell whether the sum was 2+437 or 19+46 if his product was 874. Therefore it can only be 4*61=244, which allows him to make the deduction.