Maths problem

This came in from a friend’s e-mail.

Two numbers **a & b ** between 2 and 100 are selected…

These numbers are unknown to mathematicians… The sum (a+b) is given to one mathematician Ms, while the product (a*b) is given to the second mathematician** Mp**.

Mp looks at the product he was given and says to Ms “Hmm, I have no idea what your sum could be…”

**Ms **replies “Thats no news to me, I already knew you could not deduce the sum I was given…”

And to that Mp replies “Ah ha, now I know what your sum is!”

And **Ms **responds, “And likewise I have now deduced your product…”

What are the two numbers a and b? Pl provide your steps to solve this in a spoiler box.

(Both mathematicians are brilliant and can do all calculations mentally .)

Is your question looking for the specific (unique) pair of numbers they could deduce, or is it saying they should be able to deduce any pair of numbers after communicating?

Do you mean between or between and including 2 and 100?

2<a<100 and 2<b<100
or
2≤a≤100 and 2≤b≤100

Are they to only include whole integers?

Can a and b be identical?

Presumably, the OP is looking for the unique pair of numbers which would permit such a conversation to actually occur, and means for the initial possibilities to cover the inclusive range of integers from 2 to 100 and allow for both a and b to be identical (though it doesn’t really change anything to exclude 2 and/or 100 and/or identical a and b).

The first bit of information I gleaned is that the numbers are not both prime, else Mp would have figured out both numbers immediately.

Secondly, it seems to me that the numbers must be both either towards the lower bound or the upper bound.

So, here’s the answer:

[spoiler]{a, b} must be {4, 13}. As for how I discovered it, I had no particularly clever approach except brute-force, but the brute-force is quite tractable. Here is Haskell code which carries it out:



justOne [_] = True
justOne _ = False

atLeastTwo (_:_:_) = True
atLeastTwo _ = False

allpairs = [(a, b) | a <- [2..100], b <- [a..100]] --Order doesn't matter, so we assume it's non-decreasing
decomp op x = [(a, b) | (a, b) <- allpairs, a `op` b == x]

--Recall that knowing the sum and product is equivalent to just knowing (a, b) itself
-- (since sum/2 is average, and sqrt(product^2 - average^2) gives common deviation from average)
--Thus, we rephrase "I don't know the sum/product" into "I don't know (a, b)"

hint1 (a, b) = atLeastTwo (decomp (*) (a*b)) --Mp can't figure out (a, b) off the bat
hint2 (a, b) = all hint1 (decomp (+) (a+b)) --Ms is guaranteed off the bat that hint1 holds.
hint3 (a, b) = justOne [p | p <- decomp (*) (a*b), hint2 p] --Mp can figure out (a, b) once they know that hint2 holds
hint4 (a, b) = justOne [p | p <- decomp (+) (a+b), hint1 p, hint3 p] --Ms can figure out (a, b) once they know that hint1 and hint3 hold

possibleanswers = [p | p <- allpairs, hint2 p, hint3 p, hint4 p] --Note that hint2 implies hint1


[/spoiler]

I do not know the answer to this !

But I am curious and sure that SDMB folks can crack this.

I asked my friend and he promised to give me the link ( he says this was discussed in another message board ).

These are whole integers between 2 and 100 ( not including them).

Without using a computer, how can you crack this , and what assumptions will you make ??

Pl explain it to a layman !

I think it may be mid-range because the first mathematician has “no idea” what the sum could be. There are fewer choices at the upper and lower bounds, meaning that he would know that MS had one of two or three numbers.

For example, if MP had 12, he would know that MS had to have either 8 or 7. Similarly, if MP had 7200, he would know that was a product of 10072, or 9080, or 96*75, leaving just three choices.

On the other hand, if he had 2592, the prime factorization would be
222223333, which leaves lots of possibilities (which I’m too lazy to do at the moment).

It’s easy to make brash simplifying hypotheses, stumble upon one potential answer, and then check that it actually works. The only tricky thing is proving that this answer is unique (that nothing else also works). But if we’re to ignore uniqueness, and just go for some semi-principled stumble, here’s one way (though I imagine it won’t actually be helpful to anyone):

[spoiler]As a simplifying hypothesis, let’s assume everything still works out the same if we drop the requirement that numbers be below 100. There’s no good reason to believe this is legitimate, but we’re being brash.

Mp’s first statement says “There’s more than one way to break the product of a and b down into a product of two in-range numbers”. With our simplifying hypothesis, being in-range is just a matter of being > 1; thus, this becomes “a * b has more than one non-trivial factorization”. The only way this can fail is if a and b are both primes, or one is prime and the other is its square. So Mp is just ruling these two cases out.

Ms’s first statement says “Every way to break a+b down into a sum of two in-range numbers satisfies the property Mp gives.” I.e., Ms is saying “a+b is neither a sum of two primes, nor a sum of a prime and its square”. Well, by the Goldbach Conjecture, every even number above 2 is the sum of two primes (this isn’t proven in general, but it’s proven for all numbers up to some ungodly high point, and thus every number in the range we care about). So, again being brash, we’ll take Ms’s statement to mean “a+b is neither even and greater than 2, nor some odd prime number + 2, nor a sum of a prime and its square”. But any number plus its square is even; this, in combination with the range we’re looking at, allows us to remove some redundancy, getting the statement “a+b-2 is an odd composite number”.

At this point, we’ve winnowed things enough, albeit our reasoning was short of rigorous. We can start thinking “Ok, what are the odd composite numbers? 9, 15, 21… Let’s try some of them”.

Well, if a + b - 2 is 9, what are the possibilities for (a, b)? They are (2, 9), (3, 8), (4, 7), and (5, 6). Running these through, we find that these all fail to make it all the way.

And if a + b - 2 is 15, what are the possibilities? (2, 15), (3, 14), (4, 13), …

Running these through we find… the first two fail, but (4, 13) succeeds. Hooray.

But proving uniqueness remains too tricky for me to do, except via brute-force exhaustion (of a tractable sort; see above).[/spoiler]

Not that it matters, but that sqrt should read “sqrt(average^2 - product)”.

I think I figured it out, or most of the way to it.

[spoiler]In order for Mr. P to not be able to figure out the sum, it must not be the case that both A and B are prime.

In order for Mr. S to KNOW that Mr. P could not figure it out, it must be the case that

For all i, Max(20 - s, 2) < i < Min(s - 2, 20): i is composite, or s - i is composite.

Just one case of two primes which sum to the s within the range rules it out.

Doesn’t work for 5, 2 * 3 is a case.
Doesn’t work for 6, 3 * 3
Doesn’t work for 7, 2 * 5.
Doesn’t work for 8, 3 * 5.
Doesn’t work for 9, 2 * 7.
Doesn’t work for 10, 5 * 5.

11 works (2 * 9, 3 * 8, 4 * 7, 5 * 6 all have 1+ composite)

I’ll have the fill in the rest later. The question is, of those that work, Mr. P has to know which applies when Mr. S says he is in this situation.
[/spoiler]

More stuff I’ve figured out.

[spoiler]If the sum is odd:

s - 2 must be composite. An odd number is the sum of a odd and even, and the only even prime is 2. So the only prime prime match to worry about is 2 and s - 2. So for 11, it worked. It works for odd sums 17, 23, 27, 29, 35, 37.

For even sums. I don’t think its possible in the range we are considering.

We have the match of 3 : s - 3. 5 : s - 5, 7: s - 7.

Since s is even in this case, an even sum that fits this pattern implies that there are 3 consecutive composite odd numbers all no higher than 37 (s - 3). I can’t think of any 3 consecutive composite odds in that range, so I’m going to rule out s = even.

That gives us possible sums of 17, 23, 27, 29, 35, 37 given to Mr. S.

Now, Mr. P has to know which Sum Mr. S has by the mere fact that Mr. S has one of these six, and with the knowledge of what the product is.

So, Mr. Ps product, must be such that there is no q1 and r1, and q2 and r2, such that q1 * r1 = P and q2 * r2 = P, but q1 + r1 is one of the numbers on this list, and q2 + r2 is another. If there was such a case, then Mr. P could not rule out which sum, Mr. S had.

This is a lot harder to figure out though, than the sums.[/spoiler]

Well I thought I could figure it out but no. I went through a lot of the possibilities and there’s just too many for either of the two guys to reduce it to one answer. There’s probably some trick I’m missing.

The original people only know the answer and are supposed to come up with the original two numbers. Nowhere does it say they could figure out the original two numbers with the information they had been given. they have an easier problem than us. They are not super geniuses.

I believe this puzzle was first proposed by Martin Gardner.

Indistinguishable has the right answer according to the rec.puzzles FAQ.

Mindwanderer – You’re on the same track I am.

I haven’t read Indistinguishable’s answer, cause it’s more fun to work it out together.

Here’s my thoughts:

[spoiler]FYI, we can rule out even numbers for the sum, if we believe Goldbach’s conjecture, which I think we do for numbers under 200. So the list of possible sums is basically all (odd) S such that S-2 is not prime, and 2+2< S <99+99

I’m not sure, though why you left out 11 from your list in the second post. I assume you stopped at 37 because the pattern was obvious the rest of the way and didn’t want to bother.
But like you I also don’t see any other way other than brute force to go from the list of possible sums to which one fits the problem. And I don’t have time to do it, but this seems to be the way:

First, for each possible S in the list, we need to write next to it each possible q,r (such that q + r =S) and their product, then go through the whole list and cross off every product that appears next to a different possible S.
[So for S=11, we’ve written down 2x9=18, 3x 8 = 24, 4x7 = 28, and 5x6 = 30. But we’ll cross off the 30, because next to S=17 we’ve written 2x 15 = 30 (and we’ll cross off the 30 next to S=17, too)]

And if every product for a given S is crossed off, we cross off that S, as well.

Now the remaining uncrossed S on the list are all ones where Mr P could determine which one it is after looking at the P, and knowing what Mr S said the first time. For instance if P= 18 or 24 or 28, the only possible S is 11.

But for Mr S to now know what P is, the S must have only one remaining product that’s not crossed off. So S=11 doesn’t work because Mr S doesn’t know whether P is 18, 24 or 28. So we need to go through the list of remaining S’s and see if any have only one product not crossed out. [/spoiler]
Or am I all wrong, here?

Huh? What do you mean by this? What is “the answer” if not the original two numbers?

Perhaps you mean that the answer is the sum and the product. But it’s easy to determine two numbers from their sum and their product: dividing their sum by two gives their average M. Then, we know that the two numbers take the form M+d and M-d for some common deviation d from the average. Thus, their product is (M+d)*(M-d) = M^2 - d^2. Thus, d is sqrt(M^2-product). Putting this all together, we have that the two numbers are sum/2 + sqrt((sum/2)^2-product) and sum/2 - sqrt((sum/2)^2-product).

(In my above code, I erroneously wrote the comment "–Thus, we rephrase “I don’t know the sum/product” into “I don’t know (a, b)” because of this, though, of course, that much is immediate; what this really tells us is that we can rephrase “I do know the sum/product” into “I do know (a, b)”.)

Actually, ignore this; rephrasing should take a statement into an equivalent one, not just one it implies, so what I originally said was fine.