At the beginning of the 18th century, levenitz invented the binary number. At that time, he certainly did not expect that the binary will have such a wide application in the information age. The binary number features reliability, simple operation, strict logic, and easy implementation. It has become a specialized language for computers. In computer science and a large number of mathematical applications, binary notation is essential. It is also widely used in interesting mathematics.

Let's take a look at a classic MATHEMATICAL question:

A worker works for seven days, and the boss has a piece of gold. Every day, 1/7 of the gold is paid to the worker. The boss can only cut the gold into two knives, how can we cut off 1/7 yuan of gold to workers every day?

Isn't this simple? Be careful not to break your mind.

Before giving an answer, let's look at another simple example:

1 ~ For items with 63 grams of integer weight, at least how many weights must be assigned (the weights can only be placed at one end of the Balance )?

It is difficult for people who have never learned binary to think of the answer, but if you know the binary number, it is not difficult. We know that there are only two numbers in binary: 0 and 1. the weights of these numbers are 2 ^ 0, 2 ^ 1 ^ 2, 2 ^ 3, and so on ,.... We use the sum of the product of each number multiplied by its weight to represent this number. For an 8-bit binary number, the data range can be 0 ~ 2 ^ 8.

63 = 2 ^ 6-1 = 2 ^ 0 + 2 ^ 1 + 2 ^ 2 + 2 ^ 3 + 2 ^ 4 + 2 ^ 5

Therefore, we only need to assign one weight for each of the following six different grams: 2 ^ 0 = ^ 1 = ^ 2 = ^ 2 = ^ 3 = 8 2 ^ 4 = 16, 2 ^ 5 = 32.

Similar questions include how to install Apple:

There is an existing Apple sales business. We know that the number of apples that customers may need must be between 1 and 1000, but we do not know the specific number. The customer requires that the entire box be packed with the box provided by him (each box can contain a maximum of 1000 apples). Once the box is packed, it cannot be disassembled and reloaded.

You have 1000 apples and 10 boxes in your hands. The number of apples required by the guests is unknown. How can we meet the needs of the guests?

The principle of solving the problem is the same as that of the previous question. They all use the notation of binary numbers. Because 1000 <2 ^ 10 = 1024, you only need to use 2 ^, 2 ^, 2 ^ 5, 2 ^ 6, 2 ^, 8 ^ 9, it can represent all numbers between 1 and 1023.

For example, 30 = 2 ^ 1 + 2 ^ 2 + 2 ^ 3 + 2 ^ 4; 75 = 2 ^ 0 + 2 ^ 1 + 2 ^ 3 + 2 ^ 6.

But now the total number of apples is not 1023, but 1000, so the number of apples in 10th boxes is not 512, but 489.

1000 = 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 489;

Therefore, each of the 10 boxes contains 64,128,256,489, and apples, which can meet the requirements of the entire box for any number of apples.

Now, do you understand the solution to the first question? Yes! Is binary.

Because 7 is <2 ^ 3 = 8, you only need to use 2 ^ 1 ^ 2 to represent all numbers between 1 and 7. Then we only need to divide the gold bars into three parts, with a ratio of, that is, 1/7 (set as a) of the one-size-fits-all gold bars, and 2/7 (set as B) of the gold bars with the second knife ), the rest is exactly 4/7 of the Golden stripe (set to C ). We only need to pay the salary as follows to solve the problem:

The first day --> give the foreman A; (1 = 2 ^ 0)

The next day --> give the foreman B and get a back; (2 = 2 ^ 1)

Day 3 --> send a to long worker (3 = 2 ^ 0 + 2 ^ 1)

The fourth day --> give the foreman c and take a and B back; (4 = 2 ^ 2)

Day 5 --> send a to long worker (5 = 2 ^ 0 + 2 ^ 2)

Day 6 --> give the foreman B and take a back; (6 = 2 ^ 1 + 2 ^ 2)

On the seventh day, give the foreman. (5 = 2 ^ 0 + 2 ^ 1 + 2 ^ 2)

The above three problems have already proved the application of binary in interesting mathematics. We can use this method to solve a series of such problems. The following is an interesting question about the bottle:

A drug store received ten bottles of certain medicines. 1000 pills per bottle. The pharmacist Mr. White had just delivered the medicine bottle to the shelf, and a telegram followed. Mr. White sent the telegram to the pharmacy manager Miss Black.

Mr. White: "Urgent! All medicine bottles must be inspected before they can be sold. One bottle of pills was 10 mg overweight per tablet due to a mistake. Please return the bottle of medicine with incorrect components. Mr White is very angry.

Mr. White: "Unfortunately, I have to take one from each bottle to name it. It's really fun.

Mr. White was about to start, and Miss Black stopped him. Miss Black: "Wait, there is no need to name it ten times. It is enough to name it once ."

How is this possible?

Miss Black's wonderful idea was to take one from the first bottle, two from the second bottle, three from the third bottle, and so on until ten from the tenth bottle. Place the 55 pills on the scale and write down the total weight. If the weight is 5510 mg, or more than 10 mg, she immediately realized that only one of them was overweight and was taken from the first bottle.

If the total weight exceeds 20 mg, two of them are overweight and taken from the second bottle, and so on. So Miss Black only needs to name it once, isn't it?

Six months later, the drugstore received ten more bottles of the drug. An expedited telegram followed, pointing out a worse mistake.

This time, each tablet is still 10 mg overweight, but there is no evidence of the number of excess pills, that is, several bottles may be overweight. Mr White was so angry. Mr. White: "What should I do, Miss Black? We did not use the last method. Miss Black did not answer immediately. She was thinking about this question.

Miss Black: "Good. However, if we change that method, we can identify the medicines with incorrect components only once. What are the good ideas for Miss Black?

Please think carefully and then use the binary principle to solve it.

In the first weighing pill problem, we know that only one bottle of pills is overweight. Taking different pills from each bottle (the simplest way is to use the counting sequence), we can make a group of numbers and a group of bottles one-to-one correspondence.

To solve the second problem, we must use a sequence of numbers to mark each bottle of medicine separately, and each subset of the sequence must have a separate sum. Is there a sequence like this? Some, the simplest is the following dual sequence: 1, 2, 4, 8, 16 ,... These numbers are the consecutive power of 2. This sequence lays the foundation for binary notation.

In this case, the solution is to arrange the medicine bottle in a row, take 1 from the first bottle, 2 from the second bottle, 4 from the third bottle, and so on. Place the pills on the scale and name them. Assuming that the total weight is 270 mg, because each tablet contains an incorrect weight of 10 mg, we divide 270 by 10 and get 27, that is, the number of excess pills. Convert 27 to binary: 11011. In 11011, "1" on the right to the left, first, second, fourth, and fifth digits indicates that the weights are 1, 2, 8, and 16 respectively. Therefore, the first, second, fourth, and fifth bottles of medicine with incorrect components.

Here is a simple Poker magic, which can be confusing to your friends. This trick may seem unrelated to the weight issue, but they are based on the same binary principle.

Ask someone to wash a card and put it in your pocket. Then ask someone to enter a number within 1 to 15. Then you put your hand in your pocket and took out a group of cards as soon as you reached out. The value is exactly the same as the number he said.

This secret is simple. Before performing the magic, take a, 2, 4, and 8 into your pockets. This deck lacks four zones, which is unlikely to be noticed. After a card is washed into a pocket, it is hidden behind the four cards that were originally placed in the pocket. Ask someone to name a number. You can use your mind to express this number as the sum of the power of 2. If it is 10, you should think of: 8 + 2 = 10, then reached out into the bag, take out the cards 2 and 8.

The basis for the mind-sensing game is also the binary principle. Prepare five cards as A, B, C, D, and E, respectively, with 1 ~ 31. Ask an audience member to think about a number in this range (for example, the age of a person) and ask him to give you all the cards with this number. Then you can say the number he thinks.

The card is as follows:

A: 1 3 5 7

9 11 13 15

17 19 21 23

25 27 29 31

B: 2 3 6 7

10 11 14 15

18 19 22 23

26 27 30 31

C: 4 5 6 7

12 13 14 15

20 21 22 23

28 29 30 31

D: 8 9 10 11

12 13 14 15

24 25 26 27

28 29 30 31

E: 16 17 18 19

20 21 22 23

24 25 26 27

28 29 30 31

The secret is to add the first number of power 2 on each card. For example, if you give the cards C and E to you, you just need to add the first number 4 and 16 above to know that the number in others' minds is 20.

Why?

We can observe the number on the card and find a rule: if the number on the first card (a) is represented in five binary digits, they are, 10001,10011, 10101,10111, 11001,11011, 11101,11111.

If the numbers on the second card (B) are expressed in five binary digits, they are.

If the numbers on the third card (c) are expressed in five binary values, they are, and respectively.

Please note that the first digit from the right of each binary number on the first card is "1", and the second digit from the right of each binary number on the second card is "1 ", the third digit from the right of each binary number on the third card is "1 ". We can find that the n-digit from the right of each binary number on the N card is "1 ".

The Relationship Between the number and the card that the audience thinks is only "having" and "having", which exactly corresponds to binary digital 0 and 1. If "yes", we will record it as "1", and if "no", we will record it as "0". In this way, the card combination given to us by the audience will correspond to a binary number, if the cards C and E are handed over to you, the card combination is "whether there is no or none". The corresponding binary number is "10100", that is, the decimal number is "20 ". Another example is to hand over cards A, B, and E to you. The card combination is "whether there are any", and the corresponding binary number is "10011", that is, the decimal number "19 ".

The more digits the binary number has, the larger the value that can be expressed. If there are 6 cards, the range of the numbers is extended to 1 ~ , 7 cards can represent 1 ~ 127.

Sometimes, in order to make this trick look more mysterious, the magician deliberately painted each card in a variety of colors. He only needs to remember the power of 2 represented by each color. For example, the red card represents 1, the orange card represents 2, the yellow card represents 4, the green card represents 8, the Blue Card represents 16, and the purple card represents 32 (depending on the rainbow color order) so the magician stood at the end of the big room and asked someone to think of a number and put the card with the number on it beside him, he can show the numbers in others' minds based on the color of the cards beside him.

Based on this principle, people are also designed to play games with surnames and ages:

The performer took out seven cards and each card was filled with numbers and surnames. The cards are as follows:

Table 1:

Zhao 1 sun 3 week 5 Zheng 7 Feng 9 Jun 11 Jiang 13 Han 15

Zhu 17 Yu 19 he 21 Shi 23 hole 25 Yan 27 gold 29 Tao 31

Qi 33, 35, Bai 37, sinus 39, cloud 41, Pan 43, 45, Peng 47

Lu 49 Chang 51 Miao 53 Hua 55 Yu 57 yuan 59 State 61 Shi 63

Fei 65 CEN 67 Lei 69 listen 71 Teng 73 Luo 75 Hao 77 an 79

Happy 81 hour 83 skin 85 Qi 87 Wu 89 yuan 91 Gu 93 Ping 95

And 97 Xiao 99

Table 2

Qian 2 sun 3 Wu 6 Zheng 7 Chen 10 Jun 11 Shen 14 Han 15

Qin 18 Yu 19 Lu 22 Shi 23 Cao 26 Yan 27 Wei 30 Tao 31

Xie 34 listen 35 water 38 sinus 39 su 42 Pan 43 fan 46 Peng 47

Wei 50 Chang 51 Feng 54 flowers 55 Ren 58 yuan 59 Bao 62 Shi 63

Lian 66 CEN 67 he 70 Yu 71 Yin 74 Luo 75 Yu 78 An 79

83 Jun 86 Qi 87 more 90 Yuan 91 Meng 94 Ping 95

Mu 98 Xiao 99

Table 3:

LI 4 week 5 Wu 6 Zheng 7 Wei 12 Jiang 13 Shen 14 Han 15

Xu 20 he 21 Lu 22 Shi 23 Hua 28 Jin 29 Wei 30 Tao 31

Yu 36 Bai 37 water 38 sinus 39 Ge 44 forty 45 fan 46 Peng 47

Ma 52 Miao 53 Feng 54 Hua 55 Liu 60 bang 61 Bao 62 Shi 63

68 Lei 69 he 70 he 71 B 76 Hao 77 78 An 79

Fu 84 skin 85 listen 86 Qi 87 Bu 92 Gu 93 Meng 94 Ping 95

Yin 100

Table 4

Wang 8 Feng 9 Chen 10 Jun 11 Wei 12 Jiang 13 Shen 14 Han 15

Zhang 24-hole 25 Cao 26 Yan 27 Hua 28 Jin 29 Wei 30 Tao 31

Chapter 40 cloud 41 su 42 Pan 43 Ge 44 fan 45 fan 46 Peng 47

Fang 56 Yu 57 Ren 58 yuan 59 Liu 60 bang 61 Bao 62 Shi 63

Tang 72 Teng 73 Yin 74 Luo 75 Bi 76 Hao 77 Tang 78 An 79

Lian 88 Wu 89 more 90 Yuan 91 Bu 92 Gu 93 Meng 94 Ping 95

Table 5

Yang 16 Zhu 17 Qin 18 you 19 Xu 20 he 21 Lu 22 Shi 23

Zhang 24-hole 25 Cao 26 Yan 27 Hua 28 Jin 29 Wei 30 Tao 31

Lang 48 Lu 49 Wei 50 Chang 51 Ma 52 Miao 53 Feng 54 Hua 55

Fang 56 Yu 57 Ren 58 yuan 59 Liu 60 bang 61 Bao 62 Shi 63

Chang 80 happy 81 at 82 hour 83 Fu 84 skin 85 listen 86 Qi 87

Lian 88 Wu 89 more 90 Yuan 91 Bu 92 Gu 93 Meng 94 Ping 95

Table 6:

Wu 32 into 33 Xie 34 listen 35 Yu 36 Bai 37 water 38 sinus 39

Chapter 40 cloud 41 su 42 Pan 43 Ge 44 fan 45 fan 46 Peng 47

Lang 48 Lu 49 Wei 50 Chang 51 Ma 52 Miao 53 Feng 54 Hua 55

Fang 56 Yu 57 Ren 58 yuan 59 Liu 60 bang 61 Bao 62 Shi 63

Huang 96 and 97 Mu 98 Xiao 99 Yin 100

Table 7:

Tang 64 fee 65 Lian 66 CEN 67 listen 68 Lei 69 he 70 listen 71

Tang 72 Teng 73 Yin 74 Luo 75 Bi 76 Hao 77 Tang 78 An 79

Chang 80 happy 81 at 82 hour 83 Fu 84 skin 85 listen 86 Qi 87

Lian 88 Wu 89 more 90 Yuan 91 Bu 92 Gu 93 Meng 94 Ping 95

Huang 96 and 97 Mu 98 Xiao 99 Yin 100

The performer said, "Anyone with your age and last name can guess them immediately ."

His voice just fell, and someone said, "My age is on the first table ."

"Are there any other tables ?" Ask the performer.

The man looked at the table in detail and added: "The third and fifth tables also exist ."

"You cannot omit any table !" The performer said, "If you are on the first, third, and fifth tables, you are 21 years old ."

Guess it!

Some people said, "My surnames are on table 2, table 3, table 4, table 5, and table 7 ."

"That is to say, you are a descendant of Meng laofu !"

People asked one after another, and the performers answered one by one without making a mistake. They were stunned. However, no one knows the secrets hidden in this strange table except you.

Let's unveil the secrets!