Puzzles between Mr s and Mr P

Source: Internet
Author: User
Tags two factor

From the Stanford University in the United States

There are two natural numbers x, y, 2 <= x <= Y <= 99. Mr. S knows the sum of the two numbers, and Mr. P knows the product P of the two numbers, the two of them had the following conversation:

S: I'm sure you don't know what these two numbers are, but I don't know either.

P: When you say this, I will know what these two numbers are.

S: Me too. Now I know.

Can you deduce the two numbers through their sessions? (Of course, Mr. S and Mr. P are both very smart)

Method 1:

Let me talk about it.

1. Mr. S does not know X, Y

Description and number S are not 197,198

2. Mr. S knows that Mr. P does not know X, Y

First, what kind of data can Mr. P know?

For example, S = 8

8 = 2*4 8 = 1*8 the latter is impossible (X, Y> = 2)

Another example is S = 25.

25 = 5*5 only one

In this way, Mr. P can know that X, Y

This indicates that S = m1 + n1 = m2 + n2 = .....

M1 * N1 is decomposed into two or more forms of product,

If S = 11

11 = 2 + 9 2*9 = 18 18 = 2*9 = 3*6

11 = 3 + 8 3*8 = 24 24 = 2*12 = 3*8 = 4*6

11 = 4 + 7 4*7 = 28 28 = 2*14 = 4*7

In this way, Mr. S can determine that Mr. P does not know X, Y

So what Mr. S knows and what s is:

Sa = {, 53 ...}

Sa cannot be 29, because 29 = 7 + 11 + 11, then X, Y = 88,11,

Also get SA =}

3. After listening to Mr. S, Mr. P knows about X and Y.

We can imagine Mr. P. According to Mr. S, what Mr. S knows is the number in the SA of the set.

If the product P we know is divided into M * n, one of them (m + n) is the number in the SA of the set.

Then m, n is the number x, y

For example, P = 18

18 = 2*9 2 + 9 = 11

18 = 3*6 3 + 6 = 9

11 belongs to sa

X and Y are 2 and 9.

If P = 72

72 = 2*36 2 + 36 = 38

72 = 3*24 3 + 24 = 27

......

72 = 8*9 8 + 9 = 17

Both 27 and 17 belong to sa.

So 72 was excluded.

So the product that Mr. P knows is as follows:

PB = ,....}

The X and Y we know are product in Pb, and the two pairs after product decomposition have only one number pair in SA, which is recorded

XY = {(x1, Y1), (X2, Y2 ),.....}

Mr. 4. s knows that X, Y

Yes. At this time, Mr. s also knows that Mr. P knows the number range XY.

If the number s after s decomposition is m + n, (m, n), it is only the same as one of the number pairs in xy.

In this way, Mr. S finds X and Y, but there is no such number.

Method 2:

I have seen the answer, which is written according to my understanding.

1. S: I'm sure you don't know what these two numbers are, but I don't know either.

Why is Mr s so sure? In other words, what combination does Mr. P get to know the Mn value immediately?

First, let's take a look at the situations in which Mr. P can get the answer immediately.

(1) Mn cannot be both prime numbers.

Mn is the prime number, so the possibility of product decomposition into two factor product is unique, then Mr. P will immediately know the value of Mn.

For example, 34 = 1*34 = 2*17. Because the NM is greater than or equal to 2, the combination of 1*34 is impossible, and Mn is 2 and 17.

Mn is not a prime number, so there may be one prime number or two of them are the same.

(2) If Mn has a prime number, the prime number will not exceed 50.

If Mn has a value greater than 50, there will be a factor that will exceed 100 in other decomposition methods in the possibility of decomposing them into two factor product. However, it is inevitable that the decomposition method will be ruled out by P, then there is only one method left, and P knows the answer immediately.

For example, 318 = 6*53 = 3*106 = 2*159, because Mn is less than or equal to 99, the last two possibilities are certainly excluded. Mn must be 6, 53.

(3) If Mn is a combination, it will not exceed 50.

The reason is the same as above. It can be a p decomposition factor. In only one case, Mn is less than 100, and in other cases, Mn must have a number greater than or equal to 100.

In fact, the product of Mn is not 8 or 27, because 8 = 2*4 27 = 3*9, the decomposition factor is also a situation.

If the Mn value is above, Mr. P can immediately know the answer. That is to say, Mr. S can see the sum of Mn and immediately infer that Mn cannot exist in the above situation.

(4) s cannot be divided into the sum of three such prime numbers:

If S = 29 = 7 + 11 + 11. Then X, Y = 11,88, or 7,121 does not match.

And if S = 35 = 7 + 11 + 17, then the first two types of X, Y = 7,187 or 11,119 or do not match.

(1) s must be an odd number.

S must be an odd number. If s is an even number, Mn may be a prime number. (The original author cited the godebach conjecture that every even number greater than 2 is the sum of two prime numbers. Although this conjecture does not prove, it can be proved to be correct by experiment after the range of 100. If there is an exception, this conjecture won't be so famous. That is to say, even numbers within the range of 4-can be expressed by the sum of two prime numbers .)

(2) The sum of Mn cannot exceed 54

This speculation is based on the above 2 and 3. Because Mr. S is sure that Mr. P does not know the value of Mn, SO 2 and 3 won't react from Mn and medium.

(3) S-minus 2 is not a prime number.

In prime numbers, 2 is a special case. It is the unique even number in prime numbers. Since Mn cannot be a prime number at the same time, the value of S minus 2 is not a prime number.

(4) S is not equal to 29,35, 37,41, 47,51, 53.

If the value of S is greater than, can be used.

2. P: When you say this, I will know what these two numbers are.

Mr. P is just like us. Now we know that the sum of Mn is only possible. He only needs to product the product of two factors for the integration of Mn. Among all possibilities, the sum of the two factors in one group is exactly one of the 11 above, then Mr. P will know the Mn value.

Suppose P = 30 = 5*6 = 2*15, and 5 + 6 = 11, 2 + 15 = 17,11 and 17 are all in the number of 11 above, then Mr. P cannot determine the number of Mn groups. So P is not equal to 30.

Now that Mr. P's judgment method is known, he can start from 11 numbers and deduce them one by one.

3. S: Me too. Now I know.

According to Mr. P, Mr. S knows the integral solution factor of Mn. There is only one group of factors and the sum of the 11 numbers. Mr. s also immediately knew the Mn value. We can infer that if the sum of Mn is divided into several combinations of an odd number and an even number, only one combination meets the following conditions: the product of the odd and even numbers conforms to the judgment of Mr. P, that is, the product of the integral into two factors. In all decomposition conditions, in the case that there is only one group, the sum of the two factors is exactly one of the 11 above. In this way, Mr. s will be able to know the Mn value.

We only need to split the number of 11 into several parity combinations. If two or more combinations meet Mr P's judgment condition, then this number is not the sum of Mn. :

(1) 11 = 2 + 9 = 4 + 7 = 6 + 5 = 8 + 3

2*9 = 18 = 3*6, 3 + 6 = 9 is not in 10, SO 2*9 is correct.

4*7 = 28 = 2*14. As mentioned above, Mn is an odd couple, and 2*14 is not considered. 4*7 is consistent.

6*5 = 30 = 2*15, while 6 + 5 = 11, 2 + 15 = 17, both numbers are in the 11 number, so Mr. P cannot judge, therefore, this combination can be skipped.

8*3 = 24 = 2*12 = 4*6, SO 2*12, 4*6 do not need to be considered, 8*3 meet

Now there are three groups of numbers, so 11 is not the sum of MND.

From the above, if we split 11 into a combination of the power of 2 and a prime number, there is only one decomposition that is an odd pair. In other cases, there are two even numbers. () = (2 ^), () = (^ 3), such a combination decomposition is unique and can meet our requirements. 11 can be split into two such combinations, and 11 can be ruled out.

(2) 23 = 2 ^ 2 + 19 = 2 ^ 4 + 7

27 = 2 ^ 2 + 23 = 2 ^ 3 + 19

The number above can be split into the power of two groups and a prime number, that is, there are two groups that meet Mr. P's judgment. Therefore, these numbers can be excluded, and only 17, 29 are left.

(3) 29 = 16 + 13 = 2 + 27

2*27 = 54 = 3*18 = 6*9, compliant

16*13 is 2 ^ 4 and 13, and 13 is the prime number.

29 has two groups, so 29 is excluded.

(4) now there are only 17.

17 = 4 + 13 = 6 + 11 = 7 + 10 = 8 + 9

4*13 = * 11 = * 10 =, 8*9 = 72, only one group is allowed. No solution for troubleshooting.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.