Did you play 24 O ' Day today?

Source: Internet
Author: User

The 24-point rule is simple:

From 52 cards inside casually draw 4, after subtraction and parentheses to calculate, get 24 o'clock is the victory.

After the math is:

There are 1, 2, 3 ... 13 A total of 13 groups, can be repeated sampling, extraction 4 times, the resulting 4 number of subtraction and parentheses combined operation, the result is 24.

Simple:

For example 1 2 3 4 obviously 1* 2 *3*4 24, and 1 1 1 1 is obviously the largest can produce 4 and cannot produce 24 ...

After giving 4 numbers, is there any way to make sure that you can assert that it has no solution, except for a random test? Very easy, violent traversal.

One, for two number A, a, B:

The resulting possible operation results must be contained in the following set: {a+b,a-b,b-a,a*b,a/b (b is not 0), b/a (a not 0)}, this is very easy, the pupils can easily think out. Remember as R (AB)

Second, so continue, what are the results of the operation of three number a,b,c?

For each of the full permutations of ABC, the first two digits of the possible result set b,c and each element of set B are evaluated before the previous calculation, and finally get the set C

All the possible results can be obtained by combining each of the calculated C with ABC.

Simply put, it is R (ABC) =R (R (AB) c)

Three, for four number:

R (ABCD) =r (R (AB) r (CD)) ∪r (R (ABC) d)

At this time randomly input 4 in 1-13 of the number, you can determine whether it can make up 24 points, if possible, can also tell us how to calculate, if not, will prompt No.

Of course there are other ways to do this, but there is no direct above, for example, you can use a suffix expression to express the formula, so you do not have to pay attention to the problem of parentheses, such as the results of three digital ABC: a b C op op, b C op a OP two structure, Of course, each of the ABC's full permutations produces a corresponding result.

What's even more interesting is that if you traverse all possible situations to get all the things that can achieve 24 points, what are the possible scenarios? As mentioned above is a repeatable sampling, then the calculation formula is C (N-M+1,M), specifically

For (I from 1 to 13)

For (J from I to 13)

For (p from J to 13)

For (Q from P to 13)

Generate [i j P Q]

The final IJPQ is a qualifying sample.

As an example, input 4 7 9 12 will tell you that the solution is 9+12-(4-7) ~

Finally found that 24 points of all possible sampling 1820, 1362 can be composed of 24 points! Probability is 74.83%

24 of the factors are many: 2 4 6 8 12, in more than 20 of the number, the possible number of 24 points is the largest! So the 24-point game is more varied and fun ~

20 points below some of the number of success probability than 24 o'clock, the most extreme: 2 points of success rate of up to 96%, that is, if you play 2 points, draw the 4 cards can basically make up 2 points, so it is basically your own problem. Of course, 2 is too small, said not to be enough boldness, and 2 of the factor is less, 2 of the method is less, basically through 1+1,1*2,2/1 or a-(a-2) method to gather, feel more easy to try out.

Finally, a chapter picture: The ordinate is the probability of success (can make up the number of points of the type/all may draw the number of cards), the horizontal mark for the corresponding points (from 0 to 100)

It is easy to find that 24 is the highest point after 20, and 36, 48, 60, 72 are also relatively high peaks, because they are more factors, but why the number of their species is not 24 points high? Because these numbers are larger, with 4 1-13 of the value of the result is not more than 24 points, but if the use of such as more cards (such as two poker), 72, 60 and so the success rate should be higher.

Did you play 24 O ' Day today?

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.